Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created September 25, 2013 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeardedGinger/6694524 to your computer and use it in GitHub Desktop.
Save BeardedGinger/6694524 to your computer and use it in GitHub Desktop.
Get available WordPress user roles as checkboxes
<?php
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$roles = $wp_roles->get_names();
foreach ($roles as $role_value => $role_name) {
echo '<p><input type="checkbox" value="' . $role_value . '">'.$role_name.'</p>';
}
?>
@tivnet
Copy link

tivnet commented Oct 18, 2016

Confusing indentation.

@gangesh
Copy link

gangesh commented Sep 10, 2018

Works well! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment