[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() . ‘” />’;
} );
​
[ad_2]
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: