I work a bit with the wordpress API and I want to try to include a <meta>
-tag into my head area of my website.
This is my code (works everything fine!):
class dmd_noindex_options_page{
function __construct() {
add_action( 'wp_head', array( $this, 'set_meta') );
}
function set_meta(){
$pages = get_option('dmd_noindex_pages');
$pages_id = explode(',', $pages);
for($i = 0; count($pages_id) > $i; $i++){
if(is_page($pages_id[$i])){
echo '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">';
}
}
}
}
new dmd_noindex_options_page;
My problem:
I use the WP PlugIn Yoast SEO and if I take a look into my code of the website I see this above of my <meta>
-tag.
<!-- This site is optimized with the Yoast SEO plugin v2.3.5 - https://yoast.com/wordpress/plugins/seo/ -->
<meta name="robots" content="noindex,follow"/>
<meta name="description" content="Impressum von EK Immobilien und Kontaktaufnahme"/>
<link rel="canonical" href="http://ek.dimadirekt.com/de/impressum/" />
<meta property="og:locale" content="de_DE" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Impressum -" />
<meta property="og:description" content="Impressum von EK Immobilien und Kontaktaufnahme" />
<meta property="og:url" content="http://ek.dimadirekt.com/de/impressum/" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:description" content="Impressum von EK Immobilien und Kontaktaufnahme"/>
<meta name="twitter:title" content="Impressum -"/>
<!-- / Yoast SEO plugin. -->
I don't want deactivate this Yoast SEO PlugIn! I tried to set a higher priority of my add_action but that doesn't work.
E.g.:
add_action( 'wp_head', array( $this, 'set_meta', 2,1) );
My question is:
How can I include my <meta>
-tag above the <meta>
-tags of the Yoast SEO Plugin?
Can I include my code first of all plugins?