W3cubDocs

/WordPress

WP_Sitemaps_Renderer::render_sitemap( array $url_list )

Renders a sitemap.

Parameters

$url_list

(array) (Required) Array of URLs for a sitemap.

Source

File: wp-includes/sitemaps/class-wp-sitemaps-renderer.php

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().
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			echo $sitemap_xml;
		}
	}

Changelog

Version Description
5.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_sitemaps_renderer/render_sitemap