WordPress.org

Make WordPress Core

Ticket #10930: 10930.diff

File 10930.diff, 1.1 KB (added by dd32, 4 years ago)
  • wp-includes/classes.php

     
    450450         * Set the Headers for 404, if permalink is not found. 
    451451         * 
    452452         * Issue a 404 if a permalink request doesn't match any posts.  Don't issue 
    453          * a 404 if one was already issued, if the request was a search, or if the 
    454          * request was a regular query string request rather than a permalink 
    455          * request. Issues a 200, if not 404. 
     453         * a 404 if one was already issued or if the request was a search. 
     454         * Issues a 200, if not 404. 
    456455         * 
    457456         * @since 2.0.0 
    458457         */ 
    459458        function handle_404() { 
    460459                global $wp_query; 
    461460 
    462                 if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) { 
     461                if ( 0 == count($wp_query->posts) && !is_404() && !is_search() ) { 
    463462                        // Don't 404 for these queries if they matched an object. 
    464463                        if ( ( is_tag() || is_category() || is_author() ) && $wp_query->get_queried_object() ) { 
    465464                                if ( !is_404() )