wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_dropdown_roles › WordPress Function
Since2.1.0
Deprecatedn/a
› wp_dropdown_roles ( $selected = '' )
Parameters: |
|
Defined at: |
|
Codex: |
Prints out option HTML elements for role selectors.
Related Functions: wp_dropdown_pages, wp_dropdown_languages, wp_dropdown_cats, wp_dropdown_categories, wp_dropdown_users
Source
function wp_dropdown_roles( $selected = '' ) { $r = ''; $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role( $details['name'] ); // Preselect specified role. if ( $selected === $role ) { $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>"; } else { $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>"; } } echo $r; }