Support » Developing with WordPress » Wp User Query and Custom taxonomy?

  • Resolved futur3int

    (@futur3int)



    Hi,

    Does anyone can bring me a bit of light?

    I am using wp_user_query for a custom search in order to list user. I created a custom taxonomy for users but the query does not work on it. Is there any way I can list my users using the wp user query based on custom taxonomy terms? Any ideas would be appreciate.

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    WP_User_Query does not accept taxonomy arguments. Taxonomies are only for post type objects. How did you create a taxonomy for users? It would need to be a custom data structure. Using it in user queries would need to be via a custom SQL query since WP_User_Query cannot know about custom data structures.

    Could you be referring to user meta data instead of taxonomy? That is an entirely different topic.

    Hi BC,

    You are always there for me 😉 thx.

    Yeah I managed to create a user taxonomy following an old Justin Tadlock tutorial.

    So I guess I got my answer as I need to create an Sql query then but am not good at all with it and the way of use with wp user query seems totally blurry for me atm. I gonna have to dig this way 🙂

    TY.

    futur3int

    (@futur3int)

    I BC,

    In order to use the WpQuery properly (and it is the same with the SQL query) I had to store selected taxonomy terms (update_usermeta) into the usermeta table to make the query returns results.

    It sounds obvious but I didn’t get it at first.

    TY

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.