WP_Sitemaps_Renderer::render_sitemap()publicWP 5.5.0

Renders a sitemap.

Method of the class: WP_Sitemaps_Renderer{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Sitemaps_Renderer = new WP_Sitemaps_Renderer();
$WP_Sitemaps_Renderer->render_sitemap( $url_list );
$url_list(array) (required)
Array of URLs for a sitemap.

Changelog

Since 5.5.0 Introduced.

WP_Sitemaps_Renderer::render_sitemap() code WP 6.5.3

public function render_sitemap( $url_list ) {
	header( 'Content-Type: application/xml; charset=UTF-8' );

	$this->check_for_simple_xml_availability();

	$sitemap_xml = $this->get_sitemap_xml( $url_list );

	if ( ! empty( $sitemap_xml ) ) {
		// All output is escaped within get_sitemap_xml().
		echo $sitemap_xml;
	}
}