[wp-trac] [WordPress Trac] #46126: WP_User_Query by meta_value with Number returns nothing
WordPress Trac
noreply at wordpress.org
Mon Jan 28 15:18:08 UTC 2019
#46126: WP_User_Query by meta_value with Number returns nothing
--------------------------+-----------------------------
Reporter: juliantroeps | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 5.0.3
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When querying users with WP_User_Query by meta_value like '23432' (as
string or integer) it returns nothing. If searched by text like 'admin' it
returns all users where meta_value equals 'admin'.
{{{#!php
<?php
$user_query = new WP_User_Query(
array(
'number' => 1,
'meta_query' => array(
array(
'key' => 'customer_id',
'value' => '23432',
'compare' => 'LIKE'
)
)
)
);
$users = $user_query->get_results();
}}}
The meta_value = '23432' is in the wp_usermeta table at meta_key =
'customer_id' and by search in MySQL it returns the right entry.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46126>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list