[wp-trac] [WordPress Trac] #16563: meta_query should default type to 'STRING'

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 15 06:12:10 UTC 2011


#16563: meta_query should default type to 'STRING'
-------------------------------+------------------------------
 Reporter:  batmoo             |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:  3.1
 Severity:  normal             |  Resolution:  invalid
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------
Changes (by batmoo):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Turns out I was just using it wrong, though, maybe there needs to be a
 dumb-proofing of `meta_query` for people like me. Instead of an array of
 arrays, I was just passing in an array:

 {{{
 $args['meta_query'] = array( 'key' => $meta_key );
 }}}

 That creates some strange SQL. I really should have been doing:

 {{{
 $args['meta_query'] = array( array( 'key' => $meta_key ) );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16563#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list