Skip to content

Instantly share code, notes, and snippets.

@vijayrami
Last active April 8, 2016 06:18
Show Gist options
  • Select an option

  • Save vijayrami/9628a459c5d31cfc847c43275dca2d74 to your computer and use it in GitHub Desktop.

Select an option

Save vijayrami/9628a459c5d31cfc847c43275dca2d74 to your computer and use it in GitHub Desktop.
Wordpress Get User Query
$country_m = $_REQUEST['country'];
$statu_m = $_REQUEST['state'];
$city_m = $_REQUEST['city'];
$query_args = array(
'role' => 'vendor',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'country',
'value' => $country_m,
'compare' => '=',
),
array(
'key' => 'state',
'value' => $statu_m,
'compare' => '=',
),
array(
'key' => 'city',
'value' => $city_m,
'compare' => '=',
)
)
);
$users = new WP_User_Query($query_args);
Referance: http://mattvarone.com/wordpress/list-users-with-wp_user_query/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment