Hello,
Thank you for contacting Rank Math today.
To remove the archive page from sitemap, just head to the page and set it to noindex. You can also use this filter: https://rankmath.com/kb/filters-hooks-api-developer/#exclude-taxonomy-from-sitemap
You can use this filter to change the XML url: https://rankmath.com/kb/filters-hooks-api-developer/#change-remove-post-url
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Michael,
Thanks for the reply. I have seen the filters but I can’t wrap my head around how to use them. Are there any specific examples?
I tried this, but the url still show up in the sitemap:
/**
* Filter the URL Rank Math SEO uses in the XML sitemap for this post type archive.
*
* @param string $archive_url The URL of this archive
* @param string $post_type The post type this archive is for.
*/
$archive_url = 'https://www.lokaalvastgoed.be/listings/';
$post_type = 'job_listing';
add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
return $archive_url;
}, 10, 2 );
Hello,
I have created the following example to exclude taxonomy.
/**
* Filter decision if taxonomy is excluded from the XML sitemap.
*
* @param bool $exclude Default false.
* @param string $type Taxonomy name.
*/
add_filter( 'rank_math/sitemap/exclude_taxonomy', function( $exclude, $type ){
if ( 'listings' === $type ) {
return true;
}
return $exclude;
}, 10, 2 );
Hoping that helps you. Thank you.
​​​​​​
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.