WordPress.org

Make WordPress Core

Ticket #11330: 11330.diff

File 11330.diff, 1.4 KB (added by wonderboymusic, 5 years ago)
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index 04286aa..3c4db22 100644
    class WP_Query { 
    14781478                        $this->is_page = true;
    14791479                        $this->is_single = false;
    14801480                } else {
    1481                 // Look for archive queries. Dates, categories, authors, search, post type archives.
    14821481
    1483                         if ( !empty($qv['s']) ) {
     1482                // Look for archive queries. Dates, categories, authors, search, post type archives.
     1483                        if ( ! empty( $qv['s'] ) || ( $this->is_main_query() && isset( $qv['s'] ) ) )
    14841484                                $this->is_search = true;
    1485                         }
    14861485
    14871486                        if ( '' !== $qv['second'] ) {
    14881487                                $this->is_time = true;
    class WP_Query { 
    22102209                                if ( !is_user_logged_in() )
    22112210                                        $search .= " AND ($wpdb->posts.post_password = '') ";
    22122211                        }
     2212                } elseif ( $this->is_search ) {
     2213                        $search = 'AND 0';
    22132214                }
    22142215
    22152216                // Allow plugins to contextually add/remove/modify the search section of the database query
    class WP_Query { 
    25572558                }
    25582559
    25592560                // Comments feeds
    2560                 if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
     2561                if ( $this->is_comment_feed && ( $this->is_archive || ( $this->is_search && ! empty( $q['s'] ) ) || !$this->is_singular ) ) {
    25612562                        if ( $this->is_archive || $this->is_search ) {
    25622563                                $cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
    25632564                                $cwhere = "WHERE comment_approved = '1' $where";