mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-01 00:10:36 +01:00
Issue a 404 if a permalink request does not match any posts.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c10118addf
commit
93f05160ec
@ -184,6 +184,16 @@ if (1 == count($posts)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue a 404 if a permalink request doesn't match any posts. Don't issue a
|
||||
// 404 if one was already issued, if the request was a search, or if the
|
||||
// request was a regular query string request rather than a permalink request.
|
||||
if ( (0 == count($posts)) && !is_404() && !is_search()
|
||||
&& !empty($_SERVER['QUERY_STRING']) &&
|
||||
(false === strpos($_SERVER['REQUEST_URI'], '?')) ) {
|
||||
$wp_query->is_404 = true;
|
||||
header("HTTP/1.x 404 Not Found");
|
||||
}
|
||||
|
||||
$wp_did_header = true;
|
||||
endif;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user