Created
September 26, 2017 20:25
-
-
Save michael-milette/b84d204b94d213d3b78dc3ae806f4d64 to your computer and use it in GitHub Desktop.
Get a list of all roles in WordPress and return them as an array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Get a list of all roles in WordPress and return them as an array. | |
* @return array of roles. | |
*/ | |
function getRolesArray() { | |
global $wp_roles; | |
foreach($wp_roles->roles as $key => $role) { | |
$roles[] = $key; | |
} | |
return $roles; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment