wp_ensure_editable_role()
Stop execution if the role can not be assigned by the current user.
No Hooks.
Return
null
. Nothing (null).
Usage
wp_ensure_editable_role( $role );
- $role(string) (required)
- Role the user is attempting to assign.
Changelog
Since 6.8.0 | Introduced. |
wp_ensure_editable_role() wp ensure editable role code WP 6.8
function wp_ensure_editable_role( $role ) { $roles = get_editable_roles(); if ( ! isset( $roles[ $role ] ) ) { wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); } }