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.

    ​​​​​​​

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.