Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Users from Montreal, Canada

Retrieve all the users from the city of Montreal in Canada.

// WP_User_Query arguments
$args = array(
	'order'          => 'ASC',
	'orderby'        => 'display_name',
	'meta_query'     => array(
		'relation' => 'AND',
		array(
			'key'     => 'country',
			'value'   => 'Canada',
			'compare' => '=',
		),
		array(
			'key'     => 'city',
			'value'   => 'Montreal',
			'compare' => '=',
		),
	),
);

// The User Query
$user_query = new WP_User_Query( $args );