[wp-trac] [WordPress Trac] #54853: Search only searching phrases and not searching individual terms

WordPress Trac noreply at wordpress.org
Wed Jan 19 03:00:51 UTC 2022


#54853: Search only searching phrases and not searching individual terms
--------------------------+-----------------------------
 Reporter:  jchang        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  5.8.3
 Severity:  blocker       |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 {{{
 get_posts(array(
   "post_type" => "fruit",
   "s" => "apple orange banana"
 ));
 }}}

 should search for each term separately, but it does not. It searches the
 entire string as a phrase.

 Issue is within /wp-includes/class-wp-query.php line 1398. It's a simple
 change:


 {{{
 $searchand = ' AND ';
 to
 $searchand = ' OR ';
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54853>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list