WPSEO_Sitemaps::xsl_output()publicYoast 1.4.13

Spits out the XSL for the XML sitemap.

Метод класса: WPSEO_Sitemaps{}

Хуки из метода

Возвращает

null. Ничего (null).

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

$WPSEO_Sitemaps = new WPSEO_Sitemaps();
$WPSEO_Sitemaps->xsl_output( $type );
$type(строка) (обязательный)
Type to output.

Список изменений

С версии 1.4.13 Введена.

Код WPSEO_Sitemaps::xsl_output() Yoast 22.4

public function xsl_output( $type ) {

	if ( $type !== 'main' ) {

		/**
		 * Fires for the output of XSL for XML sitemaps, other than type "main".
		 */
		do_action( 'wpseo_xsl_' . $type );

		return;
	}

	header( $this->http_protocol . ' 200 OK', true, 200 );
	// Prevent the search engines from indexing the XML Sitemap.
	header( 'X-Robots-Tag: noindex, follow', true );
	header( 'Content-Type: text/xml' );

	// Make the browser cache this file properly.
	$expires = YEAR_IN_SECONDS;
	header( 'Pragma: public' );
	header( 'Cache-Control: max-age=' . $expires );
	header( 'Expires: ' . YoastSEO()->helpers->date->format_timestamp( ( time() + $expires ), 'D, d M Y H:i:s' ) . ' GMT' );

	// Don't use WP_Filesystem() here because that's not initialized yet. See https://yoast.atlassian.net/browse/QAK-2043.
	readfile( WPSEO_PATH . 'css/main-sitemap.xsl' );
}