how to get list of all users and their metadata
How do I get a list of all users with role = ‘Customers’ including all the metadata per user, means wp_users + wp_usermeta.
Query below does not generate the wanted results.
$query = "SELECT * FROM wp_users INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id ORDER BY ID DESC'); "; $data = $wpdb->get_results($query,ARRAY_A);
But that list is not correct. It shows each user x times depend of the amount of rows in wp_usermeta.
How can i filter it? That each user shows per record all his user + metadata?
Still searching for 6 hours.