WordPress at a glance
function is not described

WP_Sitemaps_Index::get_index_url() public WP 5.5.0

Builds the URL for the sitemap index.

{} It's a method of the class: WP_Sitemaps_Index{}

No Hooks.

Return

String. The sitemap index URL.

Usage

$WP_Sitemaps_Index = new WP_Sitemaps_Index();
$WP_Sitemaps_Index->get_index_url();

Notes

  • Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.

Changelog

Since 5.5.0 Introduced.

Code of WP_Sitemaps_Index::get_index_url() WP 5.5.1

<?php
public function get_index_url() {
	global $wp_rewrite;

	if ( ! $wp_rewrite->using_permalinks() ) {
		return home_url( '/?sitemap=index' );
	}

	return home_url( '/wp-sitemap.xml' );
}