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.
Method of the class: WP_Sitemaps{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->send_404(): void;
Notes
Global. WP_Query. $wp_query WordPress Query object. |
Changelog
| Since 7.1.1 | Introduced. |
WP_Sitemaps::send_404() WP Sitemaps::send 404 code WP 7.1.3
private function send_404(): void {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
nocache_headers();
}