[wp-trac] [WordPress Trac] #17264: Duplicate posts returned if multiple meta_values match and no meta_key is set

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 27 22:55:49 UTC 2011


#17264: Duplicate posts returned if multiple meta_values match and no meta_key is
set
--------------------------+-----------------------------
 Reporter:  trepmal       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I'm currently experiencing issues that appear to be related to the second
 point of [http://core.trac.wordpress.org/ticket/12660 12660], "Using just
 meta_value returns duplicate posts based on the meta_value"

 I have a post with multiple custom fields, for example

 "address" with value "123 Lorem St"[[BR]]
 "city" with value "Lorem"

 When I perform a search to return posts with any meta_value LIKE 'sequim'
 ...

 {{{
 $args = array(
         'meta_query' => array(
                 array(
                         'value' => 'lorem',
                         'compare' => 'LIKE'
                 )
         )
 );
 query_posts($args);
 }}}

 ... the post I described above is returned twice, once for each meta_value
 that matches.

 I'd expect WP to handle the result in a way that duplicate posts would not
 be returned.

 My current workaround is to require the user to choose a key to search in,
 but I'd like to be able to do more of an all-in-one search.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17264>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list