WordPress at a glance
function is not described

WP_Sitemaps_Index::get_sitemap_list() public WP 5.5.0

Gets a sitemap list for the index.

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

No Hooks.

Return

Array[]. Array of all sitemaps.

Usage

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

Changelog

Since 5.5.0 Introduced.

Code of WP_Sitemaps_Index::get_sitemap_list() WP 5.5.1

<?php
public function get_sitemap_list() {
	$sitemaps = array();

	$providers = $this->registry->get_providers();
	/* @var WP_Sitemaps_Provider $provider */
	foreach ( $providers as $name => $provider ) {
		$sitemap_entries = $provider->get_sitemap_entries();

		// Prevent issues with array_push and empty arrays on PHP < 7.3.
		if ( ! $sitemap_entries ) {
			continue;
		}

		// Using array_push is more efficient than array_merge in a loop.
		array_push( $sitemaps, ...$sitemap_entries );
		if ( count( $sitemaps ) >= $this->max_sitemaps ) {
			break;
		}
	}

	return array_slice( $sitemaps, 0, $this->max_sitemaps, true );
}