WP::handle_404

SummerySummery

Set the Headers for 404, if nothing is found for requested URL.

Syntax

WP::handle_404()

DescriptionDescription

Issue a 404 if a request doesn’t match any posts and doesn’t match any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, and if the request was not a search or the homepage.

Otherwise, issue a 200.

This sets headers after posts have been queried. handle_404() really means "handle status." By inspecting the result of querying posts, seemingly successful requests can be switched to a 404 so that canonical redirection logic can kick in.

SourceSource

File: wp-includes/class-wp.php


			

ChangelogChangelog

Changelog
Version Description
2.0.0 Introduced.
Scroll to Top