WPSEO_Sitemaps_Renderer::get_xsl_url()protectedYoast 1.0

Retrieves the XSL URL that should be used in the current environment

When home_url and site_url are not the same, the home_url should be used. This is because the XSL needs to be served from the same domain, protocol and port as the XML file that is loading it.

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

Хуков нет.

Возвращает

Строку. The XSL URL that needs to be used.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_xsl_url();

Код WPSEO_Sitemaps_Renderer::get_xsl_url() Yoast 22.3

protected function get_xsl_url() {
	if ( home_url() !== site_url() ) {
		return home_url( 'main-sitemap.xsl' );
	}

	/*
	 * Fallback to circumvent a cross-domain security problem when the XLS file is
	 * loaded from a different (sub)domain.
	 */
	if ( strpos( plugins_url(), home_url() ) !== 0 ) {
		return home_url( 'main-sitemap.xsl' );
	}

	return plugin_dir_url( WPSEO_FILE ) . 'css/main-sitemap.xsl';
}