Hector
Member
Posted 11 months 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/
Hector
Member
Posted 11 months 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?
Hector
Member
Posted 11 months 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 = '';