[wp-trac] [WordPress Trac] #57731: Bug: WP_User_Query returns wrong user details

WordPress Trac noreply at wordpress.org
Fri Feb 17 08:24:21 UTC 2023


#57731: Bug: WP_User_Query returns wrong user details
---------------------------+------------------------------
 Reporter:  ak.singla      |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Users          |     Version:  6.1.1
 Severity:  major          |  Resolution:
 Keywords:  needs-testing  |     Focuses:
---------------------------+------------------------------

Comment (by riteshtailor):

 Replying to [comment:3 dd32]:

 > `search_columns` being explicitly set to search within `ID` does make
 this a little plugin-implementation specific though, WordPress only does
 this when the search field is explicitly numeric.
 >
 > A better check for a plugin would be something like this:
 > {{{
 >    $search = 'abc at email.com';
 >    $user_query_args = array(
 >         'search'         => $search,
 >         'search_columns' => ( is_numeric( $search ) ? ['user_email',
 'ID'] : [ 'user_email' ] )
 >     );
 >     $user_query = new WP_User_Query($user_query_args);
 > }}}

 I agrees with the comment (y)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57731#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list