filtered User list by ACF in WordPress

I have a user list at http://fze.uni-trier.de/ueber-uns/user/

every user has an ACF custom field with his Research association. I want to sort the user by this custom field. for example: If this is selected load all users by this Research association.

this is my custom query for all users.

$args = array(‘number’ => -1 );
$query = new WP_User_Query($args);

$users = $query->get_results();

// Filter out non-public profiles
$users = array_filter($users, function($user) {
    return !!get_field('oeffentliches_profil', $user);
});

My ACF Field for the Research association is

$values = get_field('forschungsverbund');

an some of my cases are:

case 'DFG-Leibniz-Forschergruppe „Nach dem Boom“':

case 'DFG-Leibniz-Forschergruppe „Vergleichende Zeitgeschichte der modernen Geschichtswissenschaften“':

case 'Forschergruppe 2539 „Resilienz. Gesellschaftliche Umbruchphasen im Dialog zwischen Mediävistik und Soziologie“':

and some more…

i query all the users at users.php Now i need a working filter but i don’t know where to start.

Thanks in advance

Read more here: filtered User list by ACF in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *