Query all users not activated
// WP_User_Query arguments
$args = array(
'role' => 'Subscriber',
'order' => 'ASC',
'orderby' => 'user_email',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'wp_capabilities',
'value' => 'participant',
'compare' => '!=',
),
array(
'key' => 'wp_capabilities',
'value' => 'administrator',
'compare' => '!=',
),
array(
'key' => 'wp_capabilities',
'value' => 'editor',
'compare' => '!=',
),
),
'count_total' => true,
);
// The User Query
$user_query = new WP_User_Query( $args );
// The User Loop
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
// do something
}
} else {
// no users found
}