WP_Sitemaps::redirect_sitemapxml
Устарела с версии 6.7.0. Больше не поддерживается и может быть удалена. Смотрите WP_Rewrite::rewrite_rules()}.
Redirects a URL to the wp-sitemap.xml
Метод класса: WP_Sitemaps{}
Хуков нет.
Возвращает
bool. Bypass value.
Использование
$WP_Sitemaps = new WP_Sitemaps(); $WP_Sitemaps->redirect_sitemapxml( $bypass, $query );
- $bypass(true|false) (обязательный)
- Pass-through of the pre_handle_404 filter value.
- $query(WP_Query) (обязательный)
- The WP_Query object.
Список изменений
| С версии 5.5.0 | Введена. |
| Устарела с 6.7.0 | Deprecated in favor of {@see WP_Rewrite::rewrite_rules()} |
Код WP_Sitemaps::redirect_sitemapxml() WP Sitemaps::redirect sitemapxml WP 7.1.4
public function redirect_sitemapxml( $bypass, $query ) {
_deprecated_function( __FUNCTION__, '6.7.0' );
// If a plugin has already utilized the pre_handle_404 function, return without action to avoid conflicts.
if ( $bypass ) {
return $bypass;
}
// 'pagename' is for most permalink types, name is for when the %postname% is used as a top-level field.
if ( 'sitemap-xml' === $query->get( 'pagename' )
|| 'sitemap-xml' === $query->get( 'name' )
) {
wp_safe_redirect( $this->index->get_index_url() );
exit();
}
return $bypass;
}