WordPress at a glance
функция не описана

WP_Sitemaps_Provider::get_sitemap_url() public WP 5.5.0

Gets the URL of a sitemap entry.

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

Хуков нет.

Возвращает

String. The composed URL for a sitemap entry.

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

$WP_Sitemaps_Provider = new WP_Sitemaps_Provider();
$WP_Sitemaps_Provider->get_sitemap_url( $name, $page );
$name(string) (required)
The name of the sitemap.
$page(int) (required)
The page of the sitemap.

Заметки

  • Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.

Changelog

Since 5.5.0 Introduced.

Код WP_Sitemaps_Provider::get_sitemap_url() WP 5.5.1

<?php
public function get_sitemap_url( $name, $page ) {
	global $wp_rewrite;

	// Accounts for cases where name is not included, ex: sitemaps-users-1.xml.
	$params = array_filter(
		array(
			'sitemap'         => $this->name,
			'sitemap-subtype' => $name,
			'paged'           => $page,
		)
	);

	$basename = sprintf(
		'/wp-sitemap-%1$s.xml',
		implode( '-', $params )
	);

	if ( ! $wp_rewrite->using_permalinks() ) {
		$basename = '/?' . http_build_query( $params, null, '&' );
	}

	return home_url( $basename );
}