Hi solosails,
No there is not a way to disable canonical URLs on a per page or post basis and I can’t think of a use case for us adding this as a feature. What is your use case for this? If you’re setting NOINDEX then the canonical URL really doesn’t matter and it’s ignored so there’s no reason to remove it.
We could probably provide you some custom code you could add for this, I’ll ask our Lead Developer to respond.
Hi there wpsmort,
There was a post by one of the Google team members (John Mueller) saying that you shouldn’t mix rel=canonical and noindex
http://www.seroundtable.com/noindex-canonical-google-18274.html
However, if you guys think this is not a problem, I am more than happy to take your word for it.
Personally, I can’t see why there should be a problem, but I have recently suffered a MASSIVE hit from google going from first page to practically invisible about a month ago and I’m very keen to make sure that there is absolutely no excuse for Google to penalise me any more!
Thanks, Andrew
Hi solosails,
I don’t think this really applies generally, as they’re talking about using canonical urls as the equivalent of a redirect vs. using noindex to not show non-canonical pages. However, it’s easy enough to support; add this code to a plugin or to the functions.php in your theme:
global $solosails_noindex;
$solosails_noindex = false;
add_filter( 'aioseop_robots_meta', 'solosails_detect_noindex' );
function solosails_detect_noindex( $robots ) {
if ( strpos( $robots, 'noindex' ) !== false ) {
global $solosails_noindex;
$solosails_noindex = true;
}
return $robots;
}
add_filter( 'aioseop_canonical_url', 'solosails_noindex_canonical_urls' );
function solosails_noindex_canonical_urls( $url ) {
global $solosails_noindex;
if ( $solosails_noindex ) return '';
return $url;
}
Hi Peter,
Thanks once again for your amazing support.
Do you think I should add this in or not? Currently I have tags set to noindex in an attempt to cut down duplicate content. And as mentioned this also has the canonical url listed as well.
Very best regards, Andrew.
Give it a try; I don’t think it’s necessary, but it shouldn’t hurt anything, as they’re noindexed anyhow.