adding meta data using plugin to top of head

It seems if you use the wp_head hook as an action to put your custom metadata into the head tags of your page, it is dependent on where the theme you are using calls the wp_head. In my case, it is at the end of the head tags.

How can I force my meta data near the top of the head tags? I have a header.php file I’m calling in using a self-made plugin. I know how to write the function code to call the header.php. I just need to know how to hook it to the start of the head tags.

Read More

Thanks,
Derek

Related posts

Leave a Reply

2 comments

  1. You can create a custom action hook into header.php file. Then you can use that action hook instead of wp_head in your plugins.

    Here’s how you can create a custom action hook into wordpress.

    <?php do_action('wpse65597_do_meta'); ?>
    

    This is how you can hook your function into that action-hook –

    add_action('wpse65597_do_meta','YOUR_FUNCTION_NAME');
    function YOUR_FUNCTION_NAME(){  
        // echo meta tags here  
    }