Hello,
Thanks for contacting us. Sorry for the delay and any inconvenience that might have been caused due to that.
As I can check, you have set your paginated pages to noindex
. We only add the canonical to pages that are set to index, if you have enabled the option to noindex
the paginated pages the canonical won’t show up on those pages.
And the canonical is used to inform the search engine crawlers about the original content and stop them from indexing the duplicate content. Since you have already stopped paginated pages from getting indexed, you don’t need a canonical tag.
If you still want to add the canonical URL to those pages then you will have to set them as index
first, from WP Dashboard > Rank Math > Titles & Meta > Misc Pages, and disable the Noindex Paginated Pages option. Then add the code given below in your theme’s functions.php file to set the canonical URL as the URL of the main page:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
if ( is_paged() ) {
$link = $_SERVER['REQUEST_URI'];
$arr = explode('/p/', $link,);
$canonical = home_url($arr[0]. '/');
}
return $canonical;
});
Hope this helps. Let us know if you need any further assistance.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.