wppaste
WordPress

WP_Sitemaps_Renderer

Since
5.5.0
Source
wp-includes/sitemaps/class-wp-sitemaps-renderer.php:17
Class WP_Sitemaps_Renderer

Compatibility

WordPress
since 5.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 2

Every hook that fires from inside WP_Sitemaps_Renderer, in the order it appears in the class, grouped by the method that fires it.

Properties · 2

$stylesheetstringprotected
XSL stylesheet for styling a sitemap for web browsers.
$stylesheet_indexstringprotected
XSL stylesheet for styling a sitemap for web browsers.

Methods · 8

Source code

#[AllowDynamicProperties]class WP_Sitemaps_Renderer {	/**	 * XSL stylesheet for styling a sitemap for web browsers.	 *	 * @since 5.5.0	 *	 * @var string	 */	protected $stylesheet = ''; 	/**	 * XSL stylesheet for styling a sitemap for web browsers.	 *	 * @since 5.5.0	 *	 * @var string	 */	protected $stylesheet_index = ''; 	/**	 * WP_Sitemaps_Renderer constructor.	 *	 * @since 5.5.0	 */	public function __construct() {		$stylesheet_url = $this->get_sitemap_stylesheet_url(); 		if ( $stylesheet_url ) {			$this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylesheet_url ) . '" ?>';		} 		$stylesheet_index_url = $this->get_sitemap_index_stylesheet_url(); 		if ( $stylesheet_index_url ) {			$this->stylesheet_index = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylesheet_index_url ) . '" ?>';		}	} 	/**	 * Gets the URL for the sitemap stylesheet.	 *	 * @since 5.5.0	 *	 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.	 *	 * @return string The sitemap stylesheet URL.	 */	public function get_sitemap_stylesheet_url() {		global $wp_rewrite; 		$sitemap_url = home_url( '/wp-sitemap.xsl' ); 		if ( ! $wp_rewrite->using_permalinks() ) {			$sitemap_url = home_url( '/?sitemap-stylesheet=sitemap' );		} 		/**		 * Filters the URL for the sitemap stylesheet.		 *		 * If a falsey value is returned, no stylesheet will be used and		 * the "raw" XML of the sitemap will be displayed.		 *		 * @since 5.5.0		 *		 * @param string $sitemap_url Full URL for the sitemaps XSL file.		 */		return apply_filters( 'wp_sitemaps_stylesheet_url', $sitemap_url );	} 	/**	 * Gets the URL for the sitemap index stylesheet.	 *	 * @since 5.5.0	 *	 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.	 *	 * @return string The sitemap index stylesheet URL.	 */	public function get_sitemap_index_stylesheet_url() {

Changelog

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.