Home › Forums › Add-ons › Flexible Content Field › Query users by custom sub fields › Reply To: Query users by custom sub fields
You are attempting to filter the where clause for posts, the “post_where” hook is not called when getting users.
To get users you would need to modify the WP_User_Query, but this class in WP does not have an equivalent hook to allow you to alter the WHERE part of the query.
In any event, this would not work because the field you are trying to look at is on the POST and not on the USER and you cannot filter users by a value that is not associated with users.
To get a list of users that are selected in a field on the post you would need to
1) Loop over all the flex rows and compile a list of the selected usres
2) Query the DB (_postmeta table) directly using $wpdp the get and then compile a list of users selected.
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.