WP_Sitemaps_Provider::get_sitemap_url( string $name, int $page ): string
- Since
- 5.5.0
- Source
wp-includes/sitemaps/class-wp-sitemaps-provider.php:148
Gets the URL of a sitemap entry.
Parameters
$namestring- The name of the sitemap.
$pageint- The page of the sitemap.
Return
string- The composed URL for a sitemap entry.
Uses · 1
- home_url()Retrieves the URL for the current site where the front end is accessible.
Used by · 1
- WP_Sitemaps_Provider::get_sitemap_entries()Lists sitemap pages exposed by this provider.
Source
public function get_sitemap_url( $name, $page ) { global $wp_rewrite; // 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( '-', $params ) ); if ( ! $wp_rewrite->using_permalinks() ) { $basename = '/?' . http_build_query( $params, '', '&' ); } return home_url( $basename ); }History
Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/sitemaps/class-wp-sitemaps-provider.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.