Home › Forums › General Issues › Querying users by custom field › Reply To: Querying users by custom field
Yes there is. ACF stores fields on user forms in the usermeta table.
The difficulty is that checkbox fields are arrays stored as serialized data. In order to do a user query you would need to use the “LIKE” compare method in the meta_query for the user query.
something like
'meta_query' => array(
array(
'key' => 'my_field',
'value' => 'my_value',
'compare' => 'LIKE'
)
)
if you’re looking for more than one value then you’d need to look for each value with and ‘AND’ or ‘OR’ for the relation value, depending on what you want returned.
https://codex.wordpress.org/Class_Reference/WP_User_Query
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.