WordPress at a glance
function is not described

get_sitemap_url() WP 5.5.1

Retrieves the full URL for a sitemap.

No Hooks.

Return

String|false. The sitemap URL or false if the sitemap doesn't exist.

Usage

get_sitemap_url( $name, $subtype_name, $page );
$name(string) (required)
The sitemap name.
$subtype_name(string)
The sitemap subtype name.
Default: empty string
$page(int)
The page of the sitemap.
Default: 1

Changelog

Since 5.5.1 Introduced.

Code of get_sitemap_url() WP 5.7.2

<?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 );
}