PHP novice here... so thanks for your patience and generous answers in advance.
I'm trying to show a list of all users who match two fields with the current user, but it's not working so I would appreciate any help!
$current_user_id = get_current_user_id();
$current_team_id = get_user_meta( $current_user_id, 'seeking_first', true );
$current_team_id = get_user_meta( $current_user_id, 'team_manager', true );
$args = array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'person_talent',
'value' => 'seeking_first',
'compare' => '='
),
array(
'key' => 'team_number',
'value' => 'current_team_id',
'compare' => '='
)
)
);
$user_query = new WP_User_Query( $args );
if ( ! empty( $user_query->get_results() ) ) {
foreach ( $user_query->get_results() as $user ) {
echo '<li>' . $user->first_name . ' - ' . $user->user_email . '</li>';
}
} else {
echo 'No users found.';
}