Hooks are WordPress function which we can applied to an action OR and filter
Developer to changed default wordpress functionality for plugins and theme files
Example of a hook
Function custom_excerpt( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= wpb_continue_reading_link();
}
Return $output;
}
add_filter( 'get_the_excerpt', 'custom_excerpt' );
Above code is help to add continue link to expert
Filter hook is help to modify the current function ex. 'get_the_excerpt' wordpress function
Here are some Filters Functions
- has_filter()
- doing_filter()
- add_filter()
- remove_filter()
function custometheme_enqueue_script() {
wp_enqueue_script( 'my-mine-js', 'mine.js', false );
}
add_action( 'wp_enqueue_scripts', 'custometheme_enqueue_script' );
Above code help to add Custom JS in your theme file.
Action hook allow to execute custom function
Here are some Actions Functions
- has_action()
- do_action()
- add_action()
- remove_action()
Hopefully this article to be helpful 🙂


