Tag Info

Hot answers tagged


Sometimes it is more useful to look at the task outside of the WordPress field, but from true programming. You can use custom SQL query to get your users ids and then do what you want with them. Place the code below into functions.php function wpse_177536_get_user_ids(){ global $wpdb; $sql = "SELECT user_id FROM $wpdb->usermeta WHERE ...


Two options. The first will keep you away from custom SQL, and should be a lot more efficient than what you currently have. It runs two queries, one to get the user ID with the highest hourly rate, and then again to get the lowest. You need one more query to update the user meta cache & then you're home free: $query = new WP_User_Query; $users = array( ...


I would highly recommend Daniel's much simpler solution over the one currently selected as correct: $user = get_userdata( $user_id ); if ( $user === false ) { //user id does not exist } else { //user id exists }

Only top voted, non community-wiki answers of a minimum length are eligible