WP_Sitemaps_Renderer::render_sitemap() WordPress Method

The WP_Sitemaps_Renderer::render_sitemap() method is used to render a sitemap for a given URL. This is typically used to generate an XML sitemap for a website, but can also be used to generate other types of sitemaps, such as HTML sitemaps.

WP_Sitemaps_Renderer::render_sitemap( array $url_list ) #

Renders a sitemap.


Parameters

$url_list

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


Top ↑

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;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.