WPSEO_Sitemaps::register_sitemap
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() WPSEO Sitemaps::register sitemap Yoast 27.4
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' );
}
}