WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. nolash74
    Member
    Posted 4 months 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
    Member
    Posted 4 months 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.

Reply

You must log in to post.

About this Topic