Sitemaps: Pass full paths to home_url()
calls.
This makes it easier for plugins using the `home_url` filter to detect sitemap URLs. Props Chouby. Fixes #50592. git-svn-id: https://develop.svn.wordpress.org/trunk@48470 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
479a125882
commit
cf4897f5d8
@ -75,7 +75,7 @@ class WP_Sitemaps_Index {
|
||||
global $wp_rewrite;
|
||||
|
||||
if ( ! $wp_rewrite->using_permalinks() ) {
|
||||
return add_query_arg( 'sitemap', 'index', home_url( '/' ) );
|
||||
return home_url( '/?sitemap=index' );
|
||||
}
|
||||
|
||||
return home_url( '/wp-sitemap.xml' );
|
||||
|
@ -145,35 +145,24 @@ abstract class WP_Sitemaps_Provider {
|
||||
public function get_sitemap_url( $name, $page ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
if ( ! $wp_rewrite->using_permalinks() ) {
|
||||
return add_query_arg(
|
||||
// Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
|
||||
array_filter(
|
||||
array(
|
||||
'sitemap' => $this->name,
|
||||
'sitemap-subtype' => $name,
|
||||
'paged' => $page,
|
||||
)
|
||||
),
|
||||
home_url( '/' )
|
||||
);
|
||||
}
|
||||
// Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
|
||||
$params = array_filter(
|
||||
array(
|
||||
'sitemap' => $this->name,
|
||||
'sitemap-subtype' => $name,
|
||||
'paged' => $page,
|
||||
)
|
||||
);
|
||||
|
||||
$basename = sprintf(
|
||||
'/wp-sitemap-%1$s.xml',
|
||||
implode(
|
||||
'-',
|
||||
// Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
|
||||
array_filter(
|
||||
array(
|
||||
$this->name,
|
||||
$name,
|
||||
(string) $page,
|
||||
)
|
||||
)
|
||||
)
|
||||
implode( '-', $params )
|
||||
);
|
||||
|
||||
if ( ! $wp_rewrite->using_permalinks() ) {
|
||||
$basename = '/?' . http_build_query( $params, null, '&' );
|
||||
}
|
||||
|
||||
return home_url( $basename );
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class WP_Sitemaps_Renderer {
|
||||
$sitemap_url = home_url( '/wp-sitemap.xsl' );
|
||||
|
||||
if ( ! $wp_rewrite->using_permalinks() ) {
|
||||
$sitemap_url = add_query_arg( 'sitemap-stylesheet', 'sitemap', home_url( '/' ) );
|
||||
$sitemap_url = home_url( '/?sitemap-stylesheet=sitemap' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,7 +98,7 @@ class WP_Sitemaps_Renderer {
|
||||
$sitemap_url = home_url( '/wp-sitemap-index.xsl' );
|
||||
|
||||
if ( ! $wp_rewrite->using_permalinks() ) {
|
||||
$sitemap_url = add_query_arg( 'sitemap-stylesheet', 'index', home_url( '/' ) );
|
||||
$sitemap_url = home_url( '/?sitemap-stylesheet=index' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user