WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Canonical broken on paged results (3 posts)

  1. Hector
    Member
    Posted 2 years ago #

    Hi all.

    My canonical tags are working strangely on multi page sets. For example, this is a working URL:

    http://www.gmvbodybuilding.com/bodybuilder-profile/page/2/?gender=male-muscle

    ... however, the canonical for such page is being printed as:

    http://www.gmvbodybuilding.com/?gender=male-muscle/page/2/

    (notice the custom taxonomy variable should be at the end but is not)

    Google is logging a gazillion 404's since all these pages obviously don't exist.

    Any ideas where is the canonical constructed or, worst-case, how could I disable it for a specific template PHP?

    Cheers!

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

  2. Hector
    Member
    Posted 2 years ago #

    BUMP!

    Anyone?

    Clues how to disable the canonical on a specific template? Or (much better, of course) anyone who had this issue and have tips to solve it?

  3. Hector
    Member
    Posted 2 years ago #

    OK, in case anyone does have this issue, what I did (probably NOT the most elegant solution) was to disable canonicals on paged results.

    In frontend/class-frontend.php I changed this line:

    $canonical = user_trailingslashit( trailingslashit( $canonical ) . 'page/' . $wp_query->query_vars['paged'] );

    To:

    $canonical = '';

    So it looks like this:

    if ( isset( $wp_query->query_vars['paged'] ) && $wp_query->query_vars['paged'] && !empty( $canonical ) )
    
    $canonical = '';

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic