Support » Requests and Feedback » [Resolved] WP_User_Query() search Bug

[Resolved] 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) {
      array(0) {
      string(1) "0"
      string(30) "SQL_CALC_FOUND_ROWS wp_users.*"
      string(13) "FROM wp_users"
      string(67) "WHERE 1=1 AND (user_login LIKE 'sand' OR user_nicename LIKE 'sand')"
      string(23) "ORDER BY user_login ASC"
      array(15) {
        string(0) ""
        string(0) ""
        string(0) ""
        string(0) ""
        array(0) {
        array(0) {
        string(4) "sand"
        string(5) "login"
        string(3) "ASC"
        string(0) ""
        string(0) ""
        string(3) "all"
        string(0) ""
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] WP_User_Query() search Bug’ is closed to new replies.