Forums
Home / Fixing WordPress / Remove rel='canonical' on Comment pages
(@drhyperlaur)
12 years, 8 months ago
Hello,
After enabling the “Break comments into pages” option in Admin panel, WordPress generates a specific page for every 50 comments:
http://www.post-link/comment-page-1/ http://www.post-link/comment-page-2/ … http://www.post-link/comment-page-n/
But because of the rel=’canonical’ in the <head>, none of the comments pages gets indexed (except of the /comment-page-1/ which is actually the post page).
Is there any way to remove the rel=’canonical’ from the /comment-page-n/ links? Or set the canonical link as http://www.post-link/comment-page-n/ rather than http://www.post-link/ ?
The 50 comments bring more value to the post and there won’t be problems with duplicate content.
I know I can completely remove the function by adding
remove_filter(‘wp_head’,’rel_canonical’);
in my theme’s functions.php, but that will remove rel=’canonical’ from all the pages and I don’t want that.
Thank you in advance!
(@msafi)
12 years ago
So, what did you end up doing to solve this problem?
(@drhyperlaur)
12 years, 8 months ago
Hello,
After enabling the “Break comments into pages” option in Admin panel, WordPress generates a specific page for every 50 comments:
http://www.post-link/comment-page-1/
http://www.post-link/comment-page-2/
…
http://www.post-link/comment-page-n/
But because of the rel=’canonical’ in the <head>, none of the comments pages gets indexed (except of the /comment-page-1/ which is actually the post page).
Is there any way to remove the rel=’canonical’ from the /comment-page-n/ links? Or set the canonical link as http://www.post-link/comment-page-n/ rather than http://www.post-link/ ?
The 50 comments bring more value to the post and there won’t be problems with duplicate content.
I know I can completely remove the function by adding
remove_filter(‘wp_head’,’rel_canonical’);
in my theme’s functions.php, but that will remove rel=’canonical’ from all the pages and I don’t want that.
Thank you in advance!