WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Possible to extend WP_User_Query? (4 posts)

  1. Brayne
    Member
    Posted 3 years ago #

    In plain English, I need the ability to "Search Users" in the admin area to find a user by last name.

    I know there have been some issues with the User Search lately. I'm looking to extend the WP_User_Query to search the wp_usermeta table.

    For example append the query for something like... WHERE meta_key = 'last_name' AND meta_value LIKE

    I'm not looking for someone to write an SQL statement, but, has anyone come across this?

    From what I can tell in the file user.php (3.1) The user query only includes a search in wp_users in the following tables..

    ID
    user_login
    user_nicename
    user_email
    user_url

  2. DougJoseph
    Member
    Posted 3 years ago #

    I'm looking for the same thing. I was working on this by going after the WP_User_Search simply because I found it in the wp-admin side of the Users Search. (I later found it is currently deprecated from what I can tell.)

    I have found some code that looks promising as a start which I could tweak to get done what I need. I'm not real close just yet.

  3. Gonçalo Peres
    Member
    Posted 3 years ago #

    Take a look at my answer in this topic:
    http://wordpress.org/support/topic/using-user-search

  4. Brayne
    Member
    Posted 3 years ago #

    See the code Gonçalo posted on the above link. perfect...resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic