Exclude all posts from a tag / caetgory from sitemap

  • Hi,

    Just switched from Yoast to RankMath. I was using Yoast (sitemap module disabled) + Better WP Google XML Sitemaps for Sitemaps.

    I can’t figure out how can I exclude all posts which have a specific tag from all sitemaps, like all posts under “Archive” should be disabled from sitemaps.

    I have a tag that is automatically added to posts after a certain time.

    I can not set the post to noindex as the tag is added and removed frequently.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You can fix this by coming up with some code to dynamically change the robots meta on your pages using the following filter:

     * Allows filtering of the robots meta data.
     * @param array $robots The meta robots directives.
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	return $robots;

    Looking forward to helping you. Thank you.



    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.

Viewing 1 replies (of 1 total)

The ticket ‘Exclude all posts from a tag / caetgory from sitemap’ is closed to new replies.