Query both first_name and last_name from wp_usermeta at the same time
I can’t find a clean, native way to pull this data. There are a couple of ways I can think of to do this: First, something like: $sql = ” SELECT user_id,meta_key,meta_value FROM {$wpdb->usermeta} WHERE ({$wpdb->usermeta}.meta_key = ‘first_name’ OR {$wpdb->usermeta}.meta_key = ‘last_name’)”; $ansatte = $wpdb->get_results($sql); var_dump($sql); $users = array(); foreach ($ansatte as $a) { $users[$a->user_id][$a->meta_key] … Read more