WPSEO_Sitemaps::build_root_map()publicYoast 1.0

Build the root sitemap (example.com/sitemap_index.xml) which lists sub-sitemaps for other content types.

Метод класса: WPSEO_Sitemaps{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$WPSEO_Sitemaps = new WPSEO_Sitemaps();
$WPSEO_Sitemaps->build_root_map();

Код WPSEO_Sitemaps::build_root_map() Yoast 22.4

public function build_root_map() {

	$links            = [];
	$entries_per_page = $this->get_entries_per_page();

	foreach ( $this->providers as $provider ) {
		$links = array_merge( $links, $provider->get_index_links( $entries_per_page ) );
	}

	/**
	 * Filter the sitemap links array before the index sitemap is built.
	 *
	 * @param array  $links Array of sitemap links
	 */
	$links = apply_filters( 'wpseo_sitemap_index_links', $links );

	if ( empty( $links ) ) {
		$this->bad_sitemap = true;
		$this->sitemap     = '';

		return;
	}

	$this->sitemap = $this->renderer->get_index( $links );
}