• Resolved sepoto

    (@sepoto)


    Inside my themes header.php I have:

    <?php wp_head(); ?>

    From what I understand the definition of wp_head is inside

    wp-includes/general_template.php which includes some text:

    do_action( ‘wp_head’ );

    So I am told that wp_head is defined somewhere by add_action howver I have no idea where I should begin to look for the call to add_action. Where is the final definition of wp_head?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Please see this documentation: https://codex.www.ads-software.com/Plugin_API/Action_Reference/wp_head

    If that does not help, please let us know what you’re trying to accomplish and we’ll see if we can help you with that.

    Moderator bcworkz

    (@bcworkz)

    One critical bit that may not be immediately apparent from chris’ link is what ends up being output by a call to wp_head() is highly variable and flexible depending on what theme and plugins you are using. Your theme and any plugin can hook the ‘wp_head’ action and output any arbitrary content based on any conceivable context. WP itself hooks this action several times.

    The first step to finding out which functions are hooked into ‘wp_head’ is to hook ‘init’ and do global $wp_filter; print_r($wp_filter['wp_head']); in the callback. When you load a page, you will see (using your browser’s source view) an array of various callbacks to ‘wp_head’ organized by priority. You’d need to check the source code for each callback to get a full picture of what this one simple call does.

    The ‘init’ hook may not even list all callbacks, more could be added after the ‘init’ action but before wp_head() is called.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to find the definition of wp_head’ is closed to new replies.