Can’t exclude pages in category from sitemap.

#818164
  • Resolved Nico
    Rank Math free

    Hey!
    I have a few pages (pages, not posts) under a category. I’d like to exclude the category. I’ve excluded the category from the settings, but pages in the category stil show in the results (see screenshot).

    I’ve cleared cache.

    Any idea?

    I’ve also done it with Tags just to try. Same result.

    * Note that I edited my functions.php to be able to categorize and tag pages, since the default behaviour is that categories and tags only work for posts.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    I apologize for the inconvenience you are facing with excluding pages in a category from the sitemap. To exclude specific pages (not posts) under a category from the sitemap in Rank Math, you can follow these steps:

    1. Exclude Specific Pages from the Sitemap:

      • Go to your WordPress Dashboard and navigate to Rank Math SEO → Sitemap Settings → General.
      • Scroll down to Exclude Posts and enter the ID of the pages you want to exclude into the field. Remember to separate multiple IDs with a comma.
      • After entering the page IDs, click on Save Changes.
    2. Exclude Specific Categories from the Sitemap:

      • If you want to exclude the entire category, you can enter the category ID in the Exclude Terms section under Rank Math SEO → Sitemap Settings → General.

    Since you mentioned that you have already excluded the category from the settings but the pages are still showing in the results, please ensure that you have entered the correct IDs for both pages and categories. Double-check the IDs and try excluding them again following the steps above.

    If the issue persists after rechecking and excluding the pages and categories, please reply to this ticket, and a human agent from our support team will assist you further.

    Thank you for your understanding and patience.

    Sources:
    Why Isn’t My URL Included in the Sitemap? » Rank Math
    How to Exclude Content From Sitemap » Rank Math
    How to Configure Sitemaps in Rank Math – Best Settings and Tips

    Hello,

    Thank you for contacting us and sorry for any inconvenience that this issue might have caused.

    Please follow the steps below for initial troubleshooting:

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article: https://rankmath.com/kb/exclude-sitemaps-from-caching/

    If the issue persists then try disabling the transient cache for the sitemap. This will make sure that your XML sitemap always reflects the latest changes on your site. To do this, you need to add a small piece of code to your site’s functions.php file or use a plugin like Code Snippets.
    The code you need to add is this:

    
    /** 
     * Filter if XML sitemap transient cache is enabled.
     *
     * @param boolean $unsigned Enable cache or not, defaults to true
     */
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    If you’re not sure how to add this code, you can follow this guide: https://rankmath.com/kb/wordpress-hooks-actions-filters/.

    After you add the code, please clear any cache on your site or server and check your XML sitemap again. If you’re still facing issues with the sitemap, please let us know – we are happy to investigate further.

    Nico
    Rank Math free

    Such a great answer! Thanks you. Nevertheless, I’m still unable to remove the silly URLs from my page sitemap. I’ve successfully done the 3 steps.

    I’m adding the URL and login info in case you have a min to take a look. Otherwise happy to perform whatever instruction you give me.

    Thanks!

    Hello,

    Please note that the sitemap will not remove redirected URLs that are still available in the WordPress backend.

    You can either completely delete/unpublish those pages, or set them to noindex and they will be removed from the sitemap.

    We have already set these pages to noindex upon editing them, and they are already removed from your page sitemap.

    /reports/mi-aiw2/
    /reports/
    

    Looking forward to helping you.

    Nico
    Rank Math free

    Hey Reinelle! Thanks a lot for your help.
    I could have sworn the pages were already set to noindex. That’s a great easy way to remove them from the sitemap. Thanks!

    Hello,

    Glad that helped.

    If you have any other concerns, please don’t hesitate to contact us anytime to assist you further.

    Looking forward to helping you.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘Can’t exclude pages in category from sitemap.’ is closed to new replies.