Mustn’t do_action be accompanied with a function?

Lets say we have a do_action like this:

do_action('some_action');

Doesn’t this mean that there has to be a some_action() function somewhere in the wordpress like this for example:

function some_action(){
   /* blah blah blah*/
}

My question comes from a do_action() at the storefront theme of woocommerce that has a line in header.php like this:

do_action( 'storefront_header' );

But I haven’t been able to find any storefront_header() function so I started wondering perhaps not all do_actions are coming with a function of their own. Is it possible?

3 Answers
3

The param used in do_action isn’t a function is just a tag that represents the action called, the proper way to use an action is attaching functions with add_action.

You can learn more from https://developer.wordpress.org/reference/functions/do_action/

Leave a Comment