Uses
Uses | Description |
---|---|
wp-includes/sitemaps.php: wp_sitemaps_get_server() | Retrieves the current Sitemaps server instance. |
wp-includes/functions.php: absint() | Convert a value to non-negative integer. |
Retrieves the full URL for a sitemap.
(string) (Required) The sitemap name.
(string) (Optional) The sitemap subtype name.
Default value: ''
(int) (Optional) The page of the sitemap.
Default value: 1
(string|false) The sitemap URL or false if the sitemap doesn't exist.
File: wp-includes/sitemaps.php
function get_sitemap_url( $name, $subtype_name = '', $page = 1 ) { $sitemaps = wp_sitemaps_get_server(); if ( ! $sitemaps ) { return false; } if ( 'index' === $name ) { return $sitemaps->index->get_index_url(); } $provider = $sitemaps->registry->get_provider( $name ); if ( ! $provider ) { return false; } if ( $subtype_name && ! in_array( $subtype_name, array_keys( $provider->get_object_subtypes() ), true ) ) { return false; } $page = absint( $page ); if ( 0 >= $page ) { $page = 1; } return $provider->get_sitemap_url( $subtype_name, $page ); }
Version | Description |
---|---|
5.5.1 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_sitemap_url