Micah Wood @wpscholar https://wpscholar.com WordPress Hooks
Actions
What is an action?An action is an event that occurs while WordPress is running.
Event Trigger“When Jill comes by, send her to the store for milk.”
Event Listener“When Jill comes by, send her to the store for milk.”
Do ActionEvent Trigger
Add ActionEvent Listener
Remove Action
Remove All Actions
Has Action
Did Action
Current Action
Doing Action
Filters
What is a filter?A filter is a collection of functions through which variables are passed.
Handoff“When Jack hands you his Rubix cube, solve it for him.”
Manipulation“When Jack hands you his Rubix cube, solve it for him.”
Apply FiltersHandoff
Add FilterManipulation
Remove Filter
Remove All Filters
Has Filter
Current Filter
Doing Filter
Pop Quiz
Explain the difference between an action and filter.An action allows you to do something.A filter allows you to do something to something.
Demo
Register Post Type
Change Body Classes
Alter Content
Resources
• http://docs.presscustomizr.com/article/26-wordpress-actions-filters-and-hooks-a-guide-for-non-developers
• http://blog.teamtreehouse.com/hooks-wordpress-actions-filters-examples • https://codex.wordpress.org/Plugin_API/Action_Reference • https://codex.wordpress.org/Plugin_API/Filter_Reference • https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-
hooks/ • https://wordpress.org/plugins/wp-hooker/ • https://wordpress.org/plugins/debug-bar-actions-and-filters-addon/ • http://wiki.theoctaneagency.com/doku.php?id=wordpress:list-hooked-
functions • https://pantheon.io/blog/tracing-wordpress-actions-and-filters
Resources