How to search display_name column when using WP_User_Query

I’m using WP_User_Query to bring back a list of users. According to this article, I can focus the query on particular columns (I’m assuming in the wp_users table) using the search_columns param. My query: $args = array( ‘search’ => ‘Rami’, ‘search_columns’ => array( ‘user_login’, ‘user_email’, ‘display_name’ ), ); $user_query = new WP_User_Query( $args ); My … Read more

Query users by custom taxonomy and user role

I’m trying to make a query for users using WP_User_Query() I need to filter users by role shop_manager and custom taxonomy called shop-category and current taxonomy term ID. The code I have so far: <?php // WP_User_Query arguments $args = array ( ‘role’ => ‘shop_manager’, ‘order’ => ‘DESC’, ‘orderby’ => ‘user_registered’, ‘tax_query’ => array( array(‘taxonomy’ … Read more

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 … Read more