Changeset 59228
- Timestamp:
- 10/14/2024 08:47:34 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/wp-includes/class-wp-rewrite.php (modified) (2 diffs)
-
src/wp-includes/sitemaps/class-wp-sitemaps.php (modified) (2 diffs)
-
tests/phpunit/tests/canonical/sitemaps.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-rewrite.php
r56549 r59228 1288 1288 $favicon_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array(); 1289 1289 1290 // sitemap.xml -- only if installed at the root. 1291 $sitemap_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'sitemap\.xml' => $this->index . '??sitemap=index' ) : array(); 1292 1290 1293 // Old feed and service files. 1291 1294 $deprecated_files = array( … … 1450 1453 // Put them together. 1451 1454 if ( $this->use_verbose_page_rules ) { 1452 $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 );1455 $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 ); 1453 1456 } else { 1454 $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 );1457 $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 ); 1455 1458 } 1456 1459 -
trunk/src/wp-includes/sitemaps/class-wp-sitemaps.php
r55000 r59228 76 76 77 77 // Add additional action callbacks. 78 add_filter( 'pre_handle_404', array( $this, 'redirect_sitemapxml' ), 10, 2 );79 78 add_filter( 'robots_txt', array( $this, 'add_robots' ), 0, 2 ); 80 79 } … … 224 223 * 225 224 * @since 5.5.0 225 * @deprecated 6.7.0 Deprecated in favor of {@see WP_Rewrite::rewrite_rules()} 226 226 * 227 227 * @param bool $bypass Pass-through of the pre_handle_404 filter value. -
trunk/tests/phpunit/tests/canonical/sitemaps.php
r51568 r59228 53 53 54 54 /** 55 * Ensure sitemaps redirects work as expected with a more custom rewrite structure. 56 * 57 * @dataProvider data_sitemaps_canonical_pretty_redirects 58 * @ticket 61931 59 */ 60 public function test_sitemaps_canonical_custom_pretty_redirects( $test_url, $expected ) { 61 $this->set_permalink_structure( '/%category%/%year%/%monthnum%/%postname%/' ); 62 $this->assertCanonical( $test_url, $expected, 61931 ); 63 } 64 65 /** 55 66 * Data provider for test_sitemaps_canonical_pretty_redirects. 56 67 * … … 62 73 * } 63 74 */ 64 public function data_sitemaps_canonical_pretty_redirects() {75 public static function data_sitemaps_canonical_pretty_redirects() { 65 76 return array( 77 // sitemap.xml special case. 78 array( '/sitemap.xml', '/wp-sitemap.xml' ), 79 array( '/sitemap.xml/', '/wp-sitemap.xml' ), 80 66 81 // Ugly/incorrect versions redirect correctly. 67 82 array( '/?sitemap=index', '/wp-sitemap.xml' ),
Note: See TracChangeset
for help on using the changeset viewer.