WordPress.org

Ready to get started?Download WordPress

Forums

Yoast SEO plugin question - exclude canonical on two pages? (2 posts)

  1. roundaboutmv
    Member
    Posted 1 year ago #

    On the thread below someone gave me a great solution to exclude the canonical link that automatically appears through Yoast's SEO plugin:

    http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-suggestion-remove-canonical-per-post-or-page

    I was able to make it work for one page using this code on the plugins functions file:

    of function wpseo_canonical_exclude( $canonical ) {
    global $post;
    if ( $post->ID == xxx) {
    $canonical = false;
    }
    return $canonical;
    }
    add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );

    My problem is that I need to exclude the canonical on one more page, but I don't know the correct syntax. Everything I've tried so far breaks it.

  2. Tara
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic