Title: WP_User_Query() search Bug
Last modified: August 20, 2016

---

# WP_User_Query() search Bug

 *  Resolved [khoallaby](https://wordpress.org/support/users/khoallaby/)
 * (@khoallaby)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/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)

 *  Thread Starter [khoallaby](https://wordpress.org/support/users/khoallaby/)
 * (@khoallaby)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/wp_user_query-search-bug/#post-2599493)
 * found the answer here ( [http://core.trac.wordpress.org/ticket/20135](http://core.trac.wordpress.org/ticket/20135))
 * have to pass the term with wildcard (*) like *sand* vs sand

Viewing 1 replies (of 1 total)

The topic ‘WP_User_Query() search Bug’ is closed to new replies.

## Tags

 * [wp_user_query](https://wordpress.org/support/topic-tag/wp_user_query/)

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 1 reply
 * 1 participant
 * Last reply from: [khoallaby](https://wordpress.org/support/users/khoallaby/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/wp_user_query-search-bug/#post-2599493)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
