WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
How to exclude canonical URL on two pages? (1 post)

  1. roundaboutmv
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.