07-27-2023, 10:24 AM
I am working ion a wordpress project and digging around into roles etc.
I have the following code which basically gets all available roles:
<?php
global $wp_roles;
$roles = $wp_roles->get_names();
// Below code will print the all list of roles.
print_r($roles);
?>
when i run the above code i get the following output:
array ( [administrator] => Administrator [editor] => Editor [author] => Author [contributor] => Contributor [subscriber] => Subscriber [basic_contributor] => Basic Contributor )
i would like the above to be stripped from the array and into just an unordered list. How would i achieve this?
Thanks Dan
I have the following code which basically gets all available roles:
<?php
global $wp_roles;
$roles = $wp_roles->get_names();
// Below code will print the all list of roles.
print_r($roles);
?>
when i run the above code i get the following output:
array ( [administrator] => Administrator [editor] => Editor [author] => Author [contributor] => Contributor [subscriber] => Subscriber [basic_contributor] => Basic Contributor )
i would like the above to be stripped from the array and into just an unordered list. How would i achieve this?
Thanks Dan