Get Users Who Aren’t Admins

Home » Snippets » Get Users Who Aren’t Admins
0

Created with:

WP_User_Query Generator

Visibility: 

public

Creator: WPTurbo Team

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				$query_args = [
	'role__not_in' => [
		'Super Admin',
		'Administrator',
	],
];

$query = new WP_User_Query( $query_args );

if ( ! empty( $query ) && ! is_wp_error( $query ) ) {
	// The Loop
}
else {
	// no terms found
}
			

Register an account to save your snippets or go Pro to get more features.