Hello,
Thank you for contacting Rank Math today.
I added the following code to your theme functions.php to have the canonical for the specified pages set to homepage. You can change it to the URL you intend for your canonical.
/**
* Allow changing of the canonical URL.
*
* @param string $canonical The canonical URL.
*/
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
$url = $_SERVER["REQUEST_URI"];
$urlLength = strlen($url);
$isItService = strpos($url, 'service');
$isItProject = strpos($url, 'project');
if (($isItService!==false || $isItProject!==false) && $urlLength <=11)
{
$canonical = "https://www.catseo.co.uk/";
}
return $canonical;
});
Changing the canonical should automatically remove a page from the sitemap. Please check your sitemap and let us know.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thank you very much!
I appreciate your help.
Kind regards,
Krisztina
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.