Commit 08b5b0e473 for wordpress.org

commit 08b5b0e473265a486269d577ce90bfd066be95c1
Author: peterwilsoncc <peterwilsoncc@git.wordpress.org>
Date:   Tue Oct 27 02:37:54 2026 +0000

    Sitemaps: Render empty sitemap when URL's filtered to empty list.

    Modifies the site maps to render a valid site map for each URL listed on the sitemap index page, ie `/wp-sitemap.xml`.

    This changes the response code for sitemaps return an empty URL list via the `wp_sitemaps_{$sitemap_type}_pre_url_list` and related filters. This ensures that all sitemap URLs submitted to search engines via the index respond with a 200 OK response.

    Props adrianduffell, audrasjb, cybr, devansh2002, im3dabasia1, masteradhoc, westonruter, wildworks.
    Fixes #61293.



    Built from https://develop.svn.wordpress.org/trunk@64792


    git-svn-id: http://core.svn.wordpress.org/trunk@63942 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/sitemaps/class-wp-sitemaps.php b/wp-includes/sitemaps/class-wp-sitemaps.php
index 980c40642b..142cd69d8b 100644
--- a/wp-includes/sitemaps/class-wp-sitemaps.php
+++ b/wp-includes/sitemaps/class-wp-sitemaps.php
@@ -204,8 +204,8 @@ class WP_Sitemaps {

 		$url_list = $provider->get_url_list( $paged, $object_subtype );

-		// Force a 404 and bail early if no URLs are present.
-		if ( empty( $url_list ) ) {
+		// Force a 404 and bail early if the requested page is out of range.
+		if ( $paged > $provider->get_max_num_pages( $object_subtype ) ) {
 			$this->send_404();
 			return;
 		}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 8d7b3b0418..780b165f4c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta1-64791';
+$wp_version = '7.2-beta1-64792';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.