diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-admin/includes/ms.php --- a/wp/wp-admin/includes/ms.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-admin/includes/ms.php Fri Sep 05 18:52:52 2025 +0200 @@ -1172,3 +1172,17 @@ '

' . __( 'Documentation on Site Management' ) . '

' . '

' . __( 'Support forums' ) . '

'; } + +/** + * Stop execution if the role can not be assigned by the current user. + * + * @since 6.8.0 + * + * @param string $role Role the user is attempting to assign. + */ +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 ); + } +}