I asked a question a few days ago (link) about a problem I encountered with WP 4.1 and a WP_User_Query
I ran with a custom meta array. My current code worked until I upgraded to 4.1:
if( is_array($user->role) == true){
$staff_role=esc_attr(implode(", ",$user->role));
} else {$staff_role=$user->role;};
$pm = array(
'orderby' => 'display_name',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => $staff_role,
'value' => 'program_manager',
'compare' => 'LIKE'
),
array(
'key' => $staff_role,
'value' => 'administrator',
'compare' => 'LIKE'
)
)
);
// User Queries
$program_manager = new WP_User_Query( $pm );
// User Counts
$pm_count = count($program_manager->results);
// User Loop
if ( ! empty( $program_manager->results ) ) {
echo '<h2>Program Managers (' . $pm_count . ')</h2>';
foreach ( $program_manager->results as $user ) {
echo '<li>',
pods_user_profile_display($user);
echo '</li><div class="clearboth"></div><br />';
}
echo '<hr />';
} else {
echo '<h2>Program Managers</h2>No managers found.';
}
However, I didn't get an answer.
Hopefully this new question will get an answer:
I want to display a list of WP users with the role "Administrator" or "Program Manager" in a directory on my website. For example, I have 1 administrator
and 12 program_manager
s. I want the list to display all 13 users sorted by display_name