How to insert meta tag right below page title?

[ad_1]

This code will insert the meta tag, but it puts it at the end of the head section. How can I insert it right below the page title in the source of the page?

/**
* Add Meta Tags to Header
*/
add_action( ‘wp_head’, function() {
echo ‘<meta name=”description” content=”‘ . get\_the\_excerpt() . ‘” />’;
} );

&#x200B;

[ad_2]
1 Comment
  1. By using a priority – 3rd parameter of the add_action function.

    [https://developer.wordpress.org/reference/functions/add_action/#:~:text=action%20is%20called.-,%24priority,-int%20Optional])

    The page title is priority 1, so any number bigger than that.

    See the wp_head listing here:

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer