wp_ensure_editable_role( string $role )

In this article

Stop execution if the role can not be assigned by the current user.

Parameters

$rolestringrequired
Role the user is attempting to assign.

Source

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 ); } } 

Changelog

VersionDescription
6.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.

close