Why Your SEOPress Sitemap Has a Number (And How to Manage Sitemap Content)
Content
If you're using the SEOPress plugin for WordPress, you might have noticed your sitemaps have names like page-sitemap1.xml or post-sitemap1.xml. A common question from users is why that number is there and if it can be removed. This guide explains the reason behind the numbering and covers other frequent sitemap management tasks.
Why Sitemaps Have Numbers (Like -sitemap1.xml)
The number appended to sitemap filenames is a core part of how the SEOPress – On-site SEO plugin handles large amounts of content. It is not a bug or an error. The plugin uses this numbering system for pagination. If you have more than 1,000 posts, pages, or products of a specific type, SEOPress will automatically create a second sitemap (e.g., post-sitemap2.xml) to ensure each sitemap file remains a manageable size for search engines. This is a standard practice and is perfectly acceptable to search engines like Google. The official SEOPress team has stated that this URL rewrite rule is necessary for the plugin's operation and cannot be removed, even if you have far fewer than 1,000 items.
How to Exclude Content from Your Sitemap
A frequent need is to prevent certain pages or posts from appearing in the XML sitemap. The most straightforward method is to set the individual item to noindex.
- Edit the post, page, or custom post type you wish to exclude.
- Locate the SEOPress meta box within the WordPress editor.
- Find the option labeled "Do not display this page in search engine results / XML - HTML sitemaps (noindex)" and check it.
- Update or publish the post.
This method works for most standard content types, including WooCommerce shop pages. Setting a page to noindex will typically remove it from both the XML and HTML sitemaps.
Advanced Exclusion Using Hooks (For Developers)
For more advanced control, such as excluding items based on a specific taxonomy or custom condition, SEOPress provides filters. For example, to exclude hidden WooCommerce products from the sitemap, you could add code like this to your theme's functions.php file:
// Remove hidden WooCommerce products from the XML sitemap
add_filter('seopress_sitemaps_single_query', function( $args, $path ) {
if ( $path == 'product' ) {
$args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => array('exclude-from-catalog'),
'operator' => 'NOT IN',
);
};
return $args;
},10,2);
It is always recommended to use a child theme and test code snippets on a staging site before implementing them on a live website.
Resolving 404 Errors for Sitemaps
If you are receiving 404 (Page Not Found) errors for your sitemap URLs, the first step is to flush your WordPress permalinks. This can often resolve the issue.
- Navigate to Settings > Permalinks in your WordPress admin dashboard.
- Simply click the "Save Changes" button without making any modifications.
This action refreshes the rewrite rules that WordPress uses to generate URLs and can often correct sitemap access problems.
Conclusion
The numbered sitemaps generated by SEOPress are normal and indicate the plugin is correctly handling content pagination. For content exclusion, the primary method is using the noindex setting on individual items, with filters available for more complex scenarios. If sitemaps return a 404 error, flushing permalinks is the recommended first step for troubleshooting.
Related Support Threads Support
-
sitemap datehttps://wordpress.org/support/topic/sitemap-date/
-
HTML Sitemaphttps://wordpress.org/support/topic/html-sitemap-2/
-
Rename sitemaphttps://wordpress.org/support/topic/rename-sitemap-2/
-
Exclude specific URLs like shop page from Sitemaphttps://wordpress.org/support/topic/exclude-specific-urls-like-shop-page-from-sitemap/
-
Remove /shop/ page from sitemapshttps://wordpress.org/support/topic/remove-shop-page-from-sitemaps/
-
Hidden products in sitemaphttps://wordpress.org/support/topic/hidden-products-in-sitemap/
-
Can I change the names of Sitemaps?https://wordpress.org/support/topic/can-i-change-the-names-of-sitemaps/
-
Remove post from sitemaphttps://wordpress.org/support/topic/remove-post-from-sitemap/
-
Shop Base URL is not being excluded from XML Sitemaphttps://wordpress.org/support/topic/shop-base-url-is-not-being-excluded-from-xml-sitemap/
-
My blog is not on the root of my domain, any way to add the root to the sitemap?https://wordpress.org/support/topic/my-blog-is-not-on-the-root-of-my-domain-any-way-to-add-the-root-to-the-sitemap-2/
-
Why does my Pages and Products Sitemaps contain a “1” after them?https://wordpress.org/support/topic/why-does-my-pages-and-products-sitemaps-contain-a-1-after-them/
-
SHOW WooCommerce products with visibility “hidden” in XML sitemaphttps://wordpress.org/support/topic/show-woocommerce-products-with-visibility-hidden-in-xml-sitemap/
-
Remove Blog Posts Page from sitemap.xmlhttps://wordpress.org/support/topic/remove-blog-posts-page-from-sitemap-xml/
-
Exclude single page from XML sitemaphttps://wordpress.org/support/topic/exclude-single-page-from-xml-sitemap/
-
Date “Last update” in page-sitemap is the “Publish date” even in v 1.6https://wordpress.org/support/topic/date-last-update-in-sitemaps-is-the-publish-date/
-
Since the last update, sitemaps are posted with 1 and 2 in the index sitemapshttps://wordpress.org/support/topic/since-the-last-update-sitemaps-are-posted-with-1-and-2-in-the-index-sitemaps/
-
some forum public some forum privatehttps://wordpress.org/support/topic/some-forum-public-some-forum-private/
-
¿ Como editar mi sitemaps.xml/ para eliminar enlaces que no están en mi sitiohttps://wordpress.org/support/topic/como-editar-mi-sitemaps-xml-para-eliminar-enlaces-que-no-estan-en-mi-sitio/
-
String Replacement in HTML Sitemaphttps://wordpress.org/support/topic/string-replacement-in-html-sitemap/
-
Choose taxonomy exclude Sitemaphttps://wordpress.org/support/topic/choose-taxonomy-exclude-sitemap/
-
Non-canonical pages in XML sitemaphttps://wordpress.org/support/topic/non-canonical-pages-in-xml-sitemap-2/