WordPress and hooks: understanding and using them
summary
Builds a small plugin and demo theme code that actually runs: uses add_action and add_filter to add an admin submenu, inject a body class, and register custom post types (sessions, speakers, attendees) with register_post_type and rewrite flushes, then refactors into a reusable register_custom_post_type factory action. Shows priority numbers (default ~10, can be lower or negative), uses remove_action to drop the WP version meta, enqueues scripts conditionally, filters comment text to mask bad words, and inspects hooks with a Simply Show Hooks fork — all code executes live.
AI-written summary · about
chapters (16)
- 0:00Introduction and background
- 2:55Why hooks matter in WordPress
- 9:26Understanding WordPress hooks
- 12:00Actions vs filters explained
- 13:23Creating a custom post type
- 27:44Custom actions and flexibility
- 39:16Hook priorities and execution order
- 59:42Advanced hook arguments
- 1:02:12Useful WordPress hook functions
- 1:07:53Controlling client settings with hooks
- 1:17:00Moderating comments with filters
- 1:20:14Key takeaways and workflow tips
- 1:23:08Debugging hooks with plugins
- 1:27:33Practical hook examples
- 1:29:16Modifying main query with hooks
- 1:30:23Q&A and closing remarks
