Make WordPress Core

Ticket #50592: 50592.2.diff

File 50592.2.diff, 3.0 KB (added by Chouby, 6 years ago)
  • src/wp-includes/sitemaps/class-wp-sitemaps-index.php

    diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps-index.php b/src/wp-includes/sitemaps/class-wp-sitemaps-index.php
    index d558870bb0..4ec1b07d92 100644
    a b 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 a/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php b/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php
    index 924aca068c..4a879c4f38 100644
    a b abstract class WP_Sitemaps_Provider { 
    145145        public function get_sitemap_url( $name, $page ) {
    146146                global $wp_rewrite;
    147147
     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                );
     156
    148157                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( '/' )
     158                        array_walk(
     159                                $params,
     160                                function ( &$value, $key ) {
     161                                        $value = "$key=$value";
     162                                }
    159163                        );
    160                 }
    161164
    162                 $basename = sprintf(
    163                         '/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                         )
    175                 );
     165                        $basename = sprintf(
     166                                '/?%1$s',
     167                                implode( '&', $params )
     168                        );
     169                } else {
     170                        $basename = sprintf(
     171                                '/wp-sitemap-%1$s.xml',
     172                                implode( '-', $params )
     173                        );
     174                }
    176175
    177176                return home_url( $basename );
    178177        }
  • src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php

    diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php b/src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php
    index c313585d22..0069b11126 100644
    a b 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                /**