I am trying to implement search functionality to get list of all users with same meta key and value.Created form and on submission of form passing data from form to custom template page for result but not getting user details with same meta key and meta value.
$subject_name = $_POST['sub'];
global $wpdb;
$user_query = new WP_User_Query( array( 'meta_key' => 'addedsubjects_detail', 'meta_value' => $subject_name ) );
$userss = $user_query->get_results();
if (!empty($users)) {
echo '</p> <ul>';
foreach ($userss as $usrer){
echo '</p> <li>' . $usrer->display_name . '</li> <p>';
} echo '</ul> <p>';
} else {
echo 'No users found';
}