WordPress.org

Forums

WordPress SEO by Yoast
[resolved] Disbale on Specific Pages (6 posts)

  1. godthor
    Member
    Posted 3 years ago #

    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.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

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

  3. godthor
    Member
    Posted 3 years ago #

    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 site.com/lists/69 or site.com/lists/105. The problem with your plugin in this situation is it writes the canonical URL as site.com/lists 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.

  4. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    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?

  5. godthor
    Member
    Posted 3 years ago #

    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.

  6. wonderm00n
    Member
    Posted 2 years ago #

    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;
    	}

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress SEO by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic