diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/class-wp-rewrite.php --- a/wp/wp-includes/class-wp-rewrite.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/class-wp-rewrite.php Fri Sep 05 18:52:52 2025 +0200 @@ -1287,6 +1287,9 @@ // favicon.ico -- only if installed at the root. $favicon_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array(); + // sitemap.xml -- only if installed at the root. + $sitemap_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'sitemap\.xml' => $this->index . '??sitemap=index' ) : array(); + // Old feed and service files. $deprecated_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old', @@ -1449,9 +1452,9 @@ // Put them together. if ( $this->use_verbose_page_rules ) { - $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules ); + $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $sitemap_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules ); } else { - $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules ); + $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $sitemap_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules ); } /** @@ -1498,7 +1501,8 @@ /** * Refreshes the rewrite rules, saving the fresh value to the database. - * If the `wp_loaded` action has not occurred yet, will postpone saving to the database. + * + * If the {@see 'wp_loaded'} action has not occurred yet, will postpone saving to the database. * * @since 6.4.0 */ @@ -1510,7 +1514,7 @@ if ( ! did_action( 'wp_loaded' ) ) { /* - * Is not safe to save the results right now, as the rules may be partial. + * It is not safe to save the results right now, as the rules may be partial. * Need to give all rules the chance to register. */ add_action( 'wp_loaded', array( $this, 'flush_rules' ) );