07) Hooks

At various times while running, WordPress checks to see if any plugins have functions that are registered to run at that time. If so, those functions are executed.


Plugins register their functions to execute at various times using “filter” and “action” hooks.

Action functions return nothing but true, while Filter functions are expected to return something.


 

Use these commands in your plugin:

 add_action( $hook, $myFunction );
 add_filter( $hook, $myFunction );

Look for these commands in the source code of the templates to see where the hooks are executed:

 do_action( "$hook" )
 apply_filters( "$hook", "what_to_filter" )

Look into the wordpress/wp-admin/admin-footer.php template to find the admin_footer_text filter hook. It looks like this:


And, look into the wordpress/wp-admin/admin-header.php template to find the admin_notices action hook.

The conditionals in the code above show that not all admin pages use the same template.


wordpress.org/plugins/search/simply+show+hooks