WP_User_Query() search Bug
-
for example I run
$query = new WP_User_Query( array( ‘search’ => ‘sand’ ) );
and get no results returned unless I set ‘sand’ to the exact match, like ‘sandbox’ (in my case).
var_dump below. Specifically looking at the ‘query_where’, where it should be user_login LIKE ‘%sand%’ with the ampersands to actually query LIKE terms.
object(WP_User_Query)#5 (8) { ["results"]=> array(0) { } ["total_users"]=> string(1) "0" ["query_fields"]=> string(30) "SQL_CALC_FOUND_ROWS wp_users.*" ["query_from"]=> string(13) "FROM wp_users" ["query_where"]=> string(67) "WHERE 1=1 AND (user_login LIKE 'sand' OR user_nicename LIKE 'sand')" ["query_orderby"]=> string(23) "ORDER BY user_login ASC" ["query_limit"]=> NULL ["query_vars"]=> array(15) { ["blog_id"]=> int(1) ["role"]=> string(0) "" ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["meta_compare"]=> string(0) "" ["include"]=> array(0) { } ["exclude"]=> array(0) { } ["search"]=> string(4) "sand" ["orderby"]=> string(5) "login" ["order"]=> string(3) "ASC" ["offset"]=> string(0) "" ["number"]=> string(0) "" ["count_total"]=> bool(true) ["fields"]=> string(3) "all" ["who"]=> string(0) "" } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘WP_User_Query() search Bug’ is closed to new replies.