Make WordPress Core

Ticket #50592: 50592.3.diff

File 50592.3.diff, 2.8 KB (added by swissspidy, 6 years ago)
  • src/wp-includes/sitemaps/class-wp-sitemaps-index.php

    diff --git src/wp-includes/sitemaps/class-wp-sitemaps-index.php src/wp-includes/sitemaps/class-wp-sitemaps-index.php
    index d558870bb0..4ec1b07d92 100644
    class WP_Sitemaps_Index { 
    7575                global $wp_rewrite;
    7676
    7777                if ( ! $wp_rewrite->using_permalinks() ) {
    78                         return add_query_arg( 'sitemap', 'index', home_url( '/' ) );
     78                        return home_url( '/?sitemap=index' );
    7979                }
    8080
    8181                return home_url( '/wp-sitemap.xml' );
  • src/wp-includes/sitemaps/class-wp-sitemaps-provider.php

    diff --git src/wp-includes/sitemaps/class-wp-sitemaps-provider.php src/wp-includes/sitemaps/class-wp-sitemaps-provider.php
    index 924aca068c..3440f62b34 100644
    abstract class WP_Sitemaps_Provider { 
    145145        public function get_sitemap_url( $name, $page ) {
    146146                global $wp_rewrite;
    147147
    148                 if ( ! $wp_rewrite->using_permalinks() ) {
    149                         return add_query_arg(
    150                                 // Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
    151                                 array_filter(
    152                                         array(
    153                                                 'sitemap'         => $this->name,
    154                                                 'sitemap-subtype' => $name,
    155                                                 'paged'           => $page,
    156                                         )
    157                                 ),
    158                                 home_url( '/' )
    159                         );
    160                 }
     148                // Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
     149                $params = array_filter(
     150                        array(
     151                                'sitemap'         => $this->name,
     152                                'sitemap-subtype' => $name,
     153                                'paged'           => $page,
     154                        )
     155                );
    161156
    162157                $basename = sprintf(
    163158                        '/wp-sitemap-%1$s.xml',
    164                         implode(
    165                                 '-',
    166                                 // Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
    167                                 array_filter(
    168                                         array(
    169                                                 $this->name,
    170                                                 $name,
    171                                                 (string) $page,
    172                                         )
    173                                 )
    174                         )
     159                        implode( '-', $params )
    175160                );
    176161
     162                if ( ! $wp_rewrite->using_permalinks() ) {
     163                        $basename = '/?' . http_build_query( $params, null, '&' );
     164                }
     165
    177166                return home_url( $basename );
    178167        }
    179168
  • src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php

    diff --git src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php
    index c313585d22..0069b11126 100644
    class WP_Sitemaps_Renderer { 
    6767                $sitemap_url = home_url( '/wp-sitemap.xsl' );
    6868
    6969                if ( ! $wp_rewrite->using_permalinks() ) {
    70                         $sitemap_url = add_query_arg( 'sitemap-stylesheet', 'sitemap', home_url( '/' ) );
     70                        $sitemap_url = home_url( '/?sitemap-stylesheet=sitemap' );
    7171                }
    7272
    7373                /**
    class WP_Sitemaps_Renderer { 
    9898                $sitemap_url = home_url( '/wp-sitemap-index.xsl' );
    9999
    100100                if ( ! $wp_rewrite->using_permalinks() ) {
    101                         $sitemap_url = add_query_arg( 'sitemap-stylesheet', 'index', home_url( '/' ) );
     101                        $sitemap_url = home_url( '/?sitemap-stylesheet=index' );
    102102                }
    103103
    104104                /**