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 blow 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 depending on the number of rows in wp_usermeta.
How can I filter it? That each user shows per record all his user + metadata?
Topic wp-user-query user-meta Wordpress
Category Web