WPSEO_Sitemaps::register_sitemap()publicYoast 1.0

Register your own sitemap. Call this during 'init'.

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

Хуков нет.

Возвращает

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

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

$WPSEO_Sitemaps = new WPSEO_Sitemaps();
$WPSEO_Sitemaps->register_sitemap( $name, $building_function, $rewrite );
$name(строка) (обязательный)
The name of the sitemap.
$building_function(callback) (обязательный)
Function to build your sitemap.
$rewrite(строка)
Regular expression to match your sitemap with.
По умолчанию: ''

Код WPSEO_Sitemaps::register_sitemap() Yoast 22.3

public function register_sitemap( $name, $building_function, $rewrite = '' ) {
	add_action( 'wpseo_do_sitemap_' . $name, $building_function );
	if ( $rewrite ) {
		Yoast_Dynamic_Rewrites::instance()->add_rule( $rewrite, 'index.php?sitemap=' . $name, 'top' );
	}
}