Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Use a spacebar or arrow keys to navigate
Arguably, hooks are one of WordPress' most powerful, and most important, features.
While there are always places in Core where an action or filter would be useful, this is much moreso the case in our plugins.
Don't take my word for it. What does Brad Williams think?
@helenhousandi @simpledream filters everywhere!Need one of the Sharing label at the moment
— Brad Williams (@williamsba) January 3, 2013
Brad was talking specifically about Jetpack, but it is hardly the only plugin that lacks sufficient hooks.
We're all probably familiar with add_action()
and add_filter()
.
Their counterparts aren't much more complicated.
do_action()
$tag
– the name of the action that other code can hook to.$arg
– datum made available to the function that executes when this action is called.
Example:
<?php do_action( 'after_setup_theme' ); ?>
apply_filters()
$tag
– the name of the filter to hook to.$value
– the value to be filtered.
Example:
<?php $excerpt_length = apply_filters('excerpt_length', 55); ?>