Skip to content

We recently had a case where a custom developed plugin for a client was undergoing an update and we had to add a new user role to the system for them.

Since we cannot deactivate/reactivate the plugin in production once these changes were launched we wrote a method that allows for the addition of a new user role as a one-time thing.

add_action( 'init', function() {

    global $wp_roles;

    if( array_key_exists('role-slug', $wp_roles->roles ) ){

    add_role( 'role-slug', "Role Display" );

Back To Top