[wp-trac] [WordPress Trac] #23849: Unexepected results when running WP_User_Query with role and meta_query

WordPress Trac noreply at wordpress.org
Tue Apr 23 03:16:53 UTC 2013


#23849: Unexepected results when running WP_User_Query with role and meta_query
--------------------------+------------------------------
 Reporter:  layotte       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+------------------------------
Changes (by sillybean):

 * cc: steph@… (added)


Comment:

 I'm seeing something similar in beta 1, I think. If I've interpreted the
 docs correctly, this ought to show me users who haven't entered either a
 first or last name (limited to 10 for sanity):


 {{{

 $users = new WP_User_Query( array(
                 'number' => 10,
                 'meta_query' => array(
                         'relation' => 'OR',
                         array(
                                 'key' => 'first_name',
                                 'compare' => 'NOT EXISTS',
                         ),
                         array(
                                 'key' => 'last_name',
                                 'compare' => 'NOT EXISTS',
                         ),
                 )
          ) );


 }}}

 Instead I get all users who have either a first or last name set.

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


More information about the wp-trac mailing list