WP_User search by keyword - lacking wildcard in sql query (2 posts)

  1. nolash74
    Posted 2 years ago #

    WP 3.8.1

    Trying to do a keyword search for user, but the SQL has no wildcards in the LIKE statements in the WHERE part. Is this a known bug?


    ` [query_fields] => DISTINCT SQL_CALC_FOUND_ROWS wp_users.*
    [query_from] => FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id)
    INNER JOIN wp_usermeta AS mt1 ON (wp_users.ID = mt1.user_id)
    [query_where] => WHERE 1=1 AND (user_login LIKE 'a' OR user_nicename LIKE 'a') AND ( (wp_usermeta.meta_key = 'wp_capabilities' AND CAST(wp_usermeta.meta_value AS CHAR) LIKE '%gigrobot\\_booker%')
    OR (mt1.meta_key = 'wp_capabilities' AND CAST(mt1.meta_value AS CHAR) LIKE '%gigrobot\\_purchaser%') )
    [query_orderby] => ORDER BY display_name ASC
    [query_limit] => `

  2. bcworkz
    Posted 2 years ago #

    If it's on a network search it is intentional behavior. See Trac #20661. On large sites wildcard searches take a large performance hit.

Topic Closed

This topic has been closed to new replies.

About this Topic