WordPress.org

Support

Support » Plugins and Hacks » Yoast SEO » How to exclude canonical URL on two pages?

How to exclude canonical URL on two pages?

  • We have a bunch of dynamic URLs (they are real estate property listings) that are not being indexed by Google because of the canonical. From this forum I found out how to exclude it on the “Rentals” page but what is the correct syntax to exclude it from a second page? In this case, the “Sales” page?

    I’m assuming there’s might be “array” involved, but so far everything I’ve tried has broken it. Here’s the original code –

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

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

  • The topic ‘How to exclude canonical URL on two pages?’ is closed to new replies.
Skip to toolbar