Popular Categories

How to disable Yoast SEO Plugin for a specific page?

I run into a problem, where i had to make Yoast SEO plugin off/disable for a page since i wanted to handle this SEO meta titles and description automatically via some piece of code. Here is the code which can help you achieve this:

add_action(‘template_redirect’,’remove_wpseo’);

function remove_wpseo(){
if (is_page(‘pagename’)) { /* pagenmae could be your slug of page, just replace it */
global $wpseo_front;
if(defined($wpseo_front)){
remove_action(‘wp_head’,array($wpseo_front,’head’),1);
}
else {
$wp_thing = WPSEO_Frontend::get_instance();
remove_action(‘wp_head’,array($wp_thing,’head’),1);
}
}
}

Note: Place above code at the end of the functions.php file in your WordPress Theme.