Opened 5 months ago
Last modified 4 months ago
#63929 new defect (bug)
WordPress sitemap not indexing correctly when custom post types are used
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | reporter-feedback |
| Focuses: | Cc: |
Description
While testing WordPress 6.6 on a live environment, I noticed that the sitemap generated via wp-sitemap.xml is not indexing custom post types correctly.
Steps to reproduce:
Install a fresh WordPress 6.6 setup.
Register a custom post type (e.g., [cement_price]cementsprice.coms) via register_post_type().
Publish at least 10 posts under this custom post type.
Visit the sitemap (/wp-sitemap.xml).
Expected result:
All published custom post type entries should appear in the sitemap.
Actual result:
Some custom post type entries are missing from the sitemap, even when published.
Example Environment:
This issue was first noticed on https://cementsprice.com/
while running tests on cement price listings. The environment is:
WordPress 6.6
PHP 8.1
Nginx 1.22
No caching plugins enabled
Additional Notes:
Deactivating all plugins and switching to the Twenty Twenty-Five theme does not resolve the issue. It looks like the core wp_sitemaps_get_server() function might not properly register custom post types in all cases.
Type: defect (bug)
Severity: normal
Version: 6.6
Component: General
Contributor Focuses: rest-api, performance, seo
Reproduction Report
Description
This report validates whether the issue can be reproduced. Since the only current officially supported version is the last major release of WordPress, I tested it on trunk.
Environment
Actual Results
I can see the CPT and its posts in the sitemap.
Additional Notes
All in all, make sure that the
publicargument is true while you register the custom pot-type.