diff --git a/src/wp-admin/includes/class-wp-site-icon.php b/src/wp-admin/includes/class-wp-site-icon.php index ea0ab35007327..542bddbb4a1e7 100644 --- a/src/wp-admin/includes/class-wp-site-icon.php +++ b/src/wp-admin/includes/class-wp-site-icon.php @@ -48,8 +48,7 @@ class WP_Site_Icon { /* * App icon for Android/Chrome. * - * @link https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android - * @link https://developer.chrome.com/multidevice/android/installtohomescreen + * @link https://developer.chrome.com/blog/support-for-theme-color-in-chrome-39-for-android */ 192, diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps.php b/src/wp-includes/sitemaps/class-wp-sitemaps.php index d4bbe38c86b11..cb9846ad76a98 100644 --- a/src/wp-includes/sitemaps/class-wp-sitemaps.php +++ b/src/wp-includes/sitemaps/class-wp-sitemaps.php @@ -76,6 +76,7 @@ public function init() { // Add additional action callbacks. add_filter( 'robots_txt', array( $this, 'add_robots' ), 0, 2 ); + add_filter( 'pre_handle_404', array( $this, 'prevent_sitemap_404' ), 10, 2 ); } /** @@ -263,4 +264,24 @@ public function add_robots( $output, $is_public ) { return $output; } + + /** + * Prevents core from issuing a 404 status header on valid sitemap requests + * when no standard blog posts exist. + * + * @since 6.8.0 + * + * @param bool $preempt Whether to short-circuit default 404 handling. + * @param WP_Query $query The global WP_Query object. + * @return bool True to preempt 404 handling if a valid sitemap route is requested, original $preempt otherwise. + */ + public function prevent_sitemap_404( $preempt, $query ) { + if ( $query->is_main_query() && get_query_var( 'sitemap' ) ) { + if ( $this->sitemaps_enabled() ) { + return true; + } + } + + return $preempt; + } }