WordPress.org

Make WordPress Core

Changeset 4912


Ignore:
Timestamp:
02/22/07 01:55:16 (7 years ago)
Author:
ryan
Message:

Handle empty search query. Props charleshooper. fixes #3722 #3759

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/wp-includes/query.php

    r4754 r4912  
    766766            } 
    767767            $term = addslashes_gpc($q['s']);  
    768             if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')"; 
    769              
    770             $search = " AND ({$search}) "; 
     768            if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) 
     769                $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')"; 
     770 
     771            if ( !empty($search) ) 
     772                $search = " AND ({$search}) "; 
    771773        } 
    772774 
Note: See TracChangeset for help on using the changeset viewer.