WordPress’ get_super_admins() function can be used to get the logins for all the users on the current site. Its return value is in array that looks like: [ ‘maryann123’, ‘johnsmith456’, ‘annie-mcarthur’ ]. If you want WP_User objects for each of those users though, you can use get_users() function and pass in get_super_admins() as the ‘login__in‘ argument, like this:

Get non-Super Admins

If you want to do the opposite and get all non-Super Admins, you can use ‘login__not_in’ instead, like this:

 

Leave a reply

Your email address will not be published. Required fields are marked *