WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WPSEO_Sitemaps::redirect() public Yoast 1.0

Hijack requests for potential sitemaps and XSL files.

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

Хуков нет.

Возвращает

Null. Ничего.

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

$WPSEO_Sitemaps = new WPSEO_Sitemaps();
$WPSEO_Sitemaps->redirect( $query );
$query(\WP_Query) (обязательный)
Main query instance.

Код WPSEO_Sitemaps::redirect() Yoast 15.9.1

<?php
public function redirect( $query ) {

	if ( ! $query->is_main_query() ) {
		return;
	}

	$yoast_sitemap_xsl = get_query_var( 'yoast-sitemap-xsl' );

	if ( ! empty( $yoast_sitemap_xsl ) ) {
		/*
		 * This is a method to provide the XSL via the home_url.
		 * Needed when the site_url and home_url are not the same.
		 * Loading the XSL needs to come from the same domain, protocol and port as the XML.
		 *
		 * Whenever home_url and site_url are the same, the file can be loaded directly.
		 */
		$this->xsl_output( $yoast_sitemap_xsl );
		$this->sitemap_close();

		return;
	}

	$type = get_query_var( 'sitemap' );

	if ( empty( $type ) ) {
		return;
	}

	$this->set_n( get_query_var( 'sitemap_n' ) );

	if ( ! $this->get_sitemap_from_cache( $type, $this->current_page ) ) {
		$this->build_sitemap( $type );
	}

	if ( $this->bad_sitemap ) {
		$query->set_404();
		status_header( 404 );

		return;
	}

	$this->output();
	$this->sitemap_close();
}