• How can I append meta tags in the header of the page?

    For instance:
    <meta name=”robots” content=”noindex, nofollow”>

    or any other custom defined meta tag.

    I got tricked in using update_post_meta() and add_post_meta() but those function have a different purpose.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • open your theme’s header.php file
    you will find the meta stuff there
    add or subtract from it as you choose

    back up 1st

    Thread Starter bottomlessinc

    (@bottomlessinc)

    samboll, I want to do that programmatically inside a plugin so manually editing the header is not an option.

    Thanks

    Thread Starter bottomlessinc

    (@bottomlessinc)

    I actually found how to do it, it’s pretty straight forward:

    1/ Register a function to be executed when the wp_head action fires:

    add_action(‘wp_head’, ‘my_function’);

    2/ Make the function echo whatever you want in the header:

    function my_function()
    {
    echo ‘<meta name=”robots” content=”noindex, nofollow”>’;
    }

    Using this trick for the Facebook Like plugin, thanks to the smart Add Your Own Headers plugin that showed me pointers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding HTML meta tags in the header’ is closed to new replies.