WP_Sitemaps::send_404
Sends a 404 for a sitemap route that cannot be served.
WP::handle_404() exempts sitemap requests, so every sitemap 404 is issued here instead. That includes the no-cache headers handle_404() sends with its own 404, so an intermediary does not retain a 404 for a route that becomes valid once the site has more content.
Метод класса: WP_Sitemaps{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->send_404(): void;
Заметки
Global. WP_Query. $wp_query WordPress Query object. |
Список изменений
| С версии 7.1.1 | Введена. |
Код WP_Sitemaps::send_404() WP Sitemaps::send 404 WP 7.1.2
private function send_404(): void {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
nocache_headers();
}