I’m a newbie in WordPress. I’m trying to understand how it generates the XHTML pages. I guess it’s the function of do_action( 'hook-name' ) , but I’m stuck with the understanding of the instruction isset( $wp_filter['all] ) when reading the function do_action because I don’t understand what is the meaning of the word all.

Is it a PHP feature or a WordPress one?

2 s
2

all is just a string the WordPress developers picked to behave differently than any other hook. When you attach to all, your callback will fire for all other hooks.

I wouldn’t spend too much time looking at the source of do_action, just know that:

  1. add_action( 'x', 'whatever' ) will mean whatever fires for do_action( 'x' )
  2. add_action( 'all', 'whatever' ) will mean whatever fires for every do_action, regardless of the name of the hook.
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *