Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] Disbale on Specific Pages

  • Resolved godthor


    I have tried and can’t for the life of me figure a way to disable the plugin on a specific page. It would be great if this was a built in feature but alas it is not.

    I’ve tried using remove_action but I must be doing something wrong. I had tried this:

    global $wpseo_front;
    remove_action('wp_head', array($wpseo_front,'head'));

    inside a function I created. I’ve gone through various iterations of this: before wp_head, after it, changing the priority on remove_action (which I know isn’t present above), etc. I’m at a complete loss on how to disable this for this one page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Joost de Valk


    Hmm can you explain why you’d need to do that?

    I wrote a plugin and there is a page on my blog that I have a rewrite setup for. That page returns dynamic content based on the ID being sent to it. So, it looks something like or The problem with your plugin in this situation is it writes the canonical URL as every time. I have hundreds of ‘pages’ but they all have the same canonical URL.

    Additionally, the meta data and title is always the same because it’s technically one page in WordPress.

    Plugin Author Joost de Valk


    You can overwrite / filter the canonical using the wpseo_canonical filter, so you could actually “spit out” the right canonical, same goes for meta description with wpseo_description. Seems like a better solution to me than to disable the plugin altogether?

    I was just looking to disable it on certain pages, not completely. However, if I can filter using what you said then that would be perfectly fine and I agree, a far better solution.

    Thanks for the responses.

    I got it working for wpseo_canonical but not for wpseo_description.

    Here’s the code. Any idea?

    //Remover YOAST na página de empresas
    	add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );
    	function wpseo_canonical_exclude( $canonical ) {
    		global $post;
    		if ( $post->ID == 5751) {
        		$canonical = false;
    		return $canonical;
    	add_filter( 'wpseo_description', 'wpseo_description_exclude' );
    	function wpseo_description_exclude( $description ) {
    		global $post;
    		echo $description;
    		if ( $post->ID == 5751) {
        		$description = false;
    		return $description;
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Disbale on Specific Pages’ is closed to new replies.