Sitemap Generation Issue: Empty Sitemaps Created for Noindexed Custom Post Type

#1034076
  • Resolved Mr Wave
    Rank Math free

    Dear Rank Math Support Team,

    I am experiencing an issue with sitemap generation for a specific Custom Post Type (CPT) on my website using the Rank Math plugin.

    I have a CPT named “Seasons” with approximately 10,000 posts. In Rank Math’s Titles & Meta settings, I have globally set this CPT to “Noindex” by default.

    For around 200 individual “Season” posts, I have manually overridden the meta settings to “Index”, since these are fully optimized for SEO.

    However, the sitemap behavior is not matching expectations:

    1. Multiple Sitemaps Created: The sitemap index includes 8 files for this CPT:
    /seasons-sitemap1.xml
    /seasons-sitemap2.xml
    /seasons-sitemap3.xml
    /seasons-sitemap4.xml
    /seasons-sitemap5.xml
    /seasons-sitemap6.xml
    /seasons-sitemap7.xml
    /seasons-sitemap8.xml

    2. Only First Sitemap Contains Valid Posts: Only seasons-sitemap1.xml contains the ~200 indexed posts. The rest (sitemap2.xml to sitemap8.xml) are completely empty or return 404 errors.

    3. SEO Impact: These empty or invalid sitemaps are being crawled and reported as issues in Google Search Console, which can negatively affect site health and indexing performance.

    Steps I’ve Taken So Far:
    – Enabled “Include in Sitemap” for the Seasons CPT
    – Flushed sitemap cache from Rank Math > Sitemap Settings
    – Cleared server/CDN-level caches (e.g., WP Rocket / Cloudflare)
    – Confirmed Rank Math plugin is fully up to date
    – Verified global noindex settings and per-post index overrides

    Expected Behavior:
    – Sitemaps should include only indexable URLs
    – The number of generated sitemap files should correspond to the count of indexable posts, not all posts
    – Empty sitemap files should not be created or listed in the sitemap index

    Could you please review this issue and advise if it’s a bug or expected behavior?
    If it’s a bug, I would appreciate a fix or workaround to prevent empty sitemaps from being generated or listed.

    Thank you for your support.

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

    We apologize for the issue you are facing with the sitemap generation for your Custom Post Type (CPT) named "Seasons". Thank you for providing detailed information about the problem, as it helps us understand your situation better.

    Based on your description, it seems that the behavior of the sitemaps is not aligning with your expectations, especially since you have set the global noindex settings and overridden them for specific posts. Here are a few steps you can take to troubleshoot this issue further:

    1. Check Sitemap Settings: Ensure that the "Include in Sitemap" option is enabled for your "Seasons" CPT in Rank Math SEO → Sitemap Settings. You mentioned you did this, but it’s worth double-checking.

    2. Flush Permalinks: Sometimes, flushing permalinks can resolve issues related to sitemap generation. Go to Settings → Permalinks in your WordPress admin area and click the “Save Changes” button without making any changes.
      Flush permalink settings

    3. Validate Your Sitemap: Use a tool like Validate XML Sitemap to check if your sitemap is correctly configured. This can help identify any underlying issues.
      An example displaying how to validate a sitemap

    4. Check for Plugin Conflicts: Since you have a significant number of posts, conflicts with other plugins could be causing issues. You can use the Health Check plugin to identify any potential conflicts.

    5. Review Custom Canonicals: If you have set custom canonicals for any of the posts, ensure that they are not affecting their appearance in the sitemap. Rank Math includes self-referencing canonicals by default, and custom ones may lead to discrepancies.

    If after trying these steps the issue persists, it may be beneficial to reply to this ticket with your site URL so that a human agent from our support team can take a closer look at your specific setup and provide more tailored assistance.

    Thank you for your patience, and we hope to resolve this issue for you soon!

    Sources:
    Troubleshooting the “Couldn’t Fetch” Error in Google Search Console » Rank Math

    Mr Wave
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Mr Wave
    Rank Math free

    Just checking in to see if this issue is being reviewed by a real human or if I should start training my own AI to fix Rank Math bugs faster. 😅 Any updates or solutions would be greatly appreciated!

    Hello,

    Thank you for contacting Rank Math support.

    We apologise for the delay in getting back to you.

    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. Kindly add this code snippet to your site:

    
    /** 
     * 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.

    Mr Wave
    Rank Math free

    Dear Rank Math Support,

    Thank you for your response. I have carefully followed all your suggested steps, including:

    1. Flushing the Sitemap Cache using the method shown in your video.
    2. Excluding sitemap URLs from my caching plugin and also verifying exclusion in Cloudflare settings.
    3. Adding the add_filter('rank_math/sitemap/enable_caching', '__return_false'); snippet to my theme’s functions.php file to disable transient caching.
    4. Clearing all site/server-level caches completely after making the changes.
    5. Verifying that “Include in Sitemap” is enabled for the Custom Post Type (CPT) in Rank Math settings.
    6. Manually overriding the Robots Meta settings for selected posts within this CPT (as most are noindex by default, and only a few are set to index intentionally).

    Unfortunately, despite doing all the above, **the problem still persists.**

    The Core Problem:

    I have a CPT named “Seasons” that contains thousands of posts. By default, all of them are set to noindex, except for about 500 posts that I manually optimized and set to index.

    Now, Rank Math is generating **8 sitemap files** for the “Seasons” CPT:

    Out of these, **only sitemap1.xml contains any actual URLs** (the ~500 indexed ones). All the other sitemap files (2 to 8) are **completely empty** or return a 404 error.

    This behavior seems incorrect because:
    – The noindex posts should **not be included** in sitemap generation logic at all.
    – Rank Math seems to be splitting sitemaps based on the **total number of posts**, regardless of their indexability, which results in **unnecessary empty sitemaps.**
    – Google Search Console starts reporting these empty sitemaps as soft 404 or errors, which negatively impacts SEO and crawl efficiency.

    What I Expect:

    ✅ Rank Math should only generate as many sitemap files as needed based on the number of **indexable** posts.

    ❌ It should **not generate multiple empty sitemaps** based on posts that are excluded from indexing (noindex), nor include these empty files in the sitemap index.

    I truly appreciate your efforts so far, but this seems like either:
    – A **bug** in the sitemap splitting logic for CPTs with a large number of noindex posts, or
    – A **missing feature** where the sitemap generator does not filter post indexability before splitting.

    Please let me know if there is a deeper workaround, hook, or setting I’m missing — or if this needs to be escalated to the development team.

    Thank you for your support and attention to this issue.

    Best regards

    Hello,

    In this case, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping 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.

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

The ticket ‘Sitemap Generation Issue: Empty Sitemaps Created for Noindexed Custom Post Type’ is closed to new replies.