July 14, 2012
Instructor: John Dillick (@johndillick)
Slides: http://www.slideshare.net/johndillick/actions-filters
Points within the code that allow developers to hook into the execution chain ("give you and opportunity to do something too")
Examples of action hooks
// Basic
// Pass variables into the action
// Object-oriented
Remember that action hooks have priority levels - those with a higher priority will be executed first.
remove_action( $tag, $callback, $priority, $args )
remove_all_actions( $tag, $priority )
- init
- admin_init
- wp_head
- wp_footer
- admin_head
- admin_footer
Complete list: http://codex.wordpress.org/Plugin_API/Action_Reference
Filter content then return the filtered result
Syntax
Example
In 2010, WordPress added the capital_P_dangit
callback to the_content
, the_title
, comment_text
so that "Wordpress" would always be camel-cased as "WordPress"
remove_filter( $tag, $callback, $priority, $args )
remove_all_filters( $tag, $priority )
- the_content
- the_excerpt
- the_title
(Semi-)complete list: http://codex.wordpress.org/Plugin_API/Filter_Reference