How Do I Add User Roles Without Plugins in WordPress?

Adding user roles without plugins in WordPress is a little more complicated than simply adding a role field to a post or page. The following instructions assume that you have a basic understanding of how user roles work in WordPress, and you are comfortable editing the wp-config.

php file.

To add user roles without plugins:

1. Open the wp-config.

php file in your WordPress installation.

2. Locate the following line of code:

‘user_role_maps’ => array(

‘roles’ => array(

),

)

3. Add a new key under the ‘user_role_maps’ key called ‘roles’.

4. Add a new array under the ‘roles’ key called ‘add_role’.

5. Add the following key/value pairs to the ‘add_role’ array:

‘add_role_name’ => ‘Admin’,

‘add_role_description’ => ‘Administrator’,

‘add_role_responsibilities’ => array(

‘edit_posts’ => true,

‘publish_posts’ => true,

‘delete_posts’ => true,

6. Save the wp-config.

7. Activate the new user role in WordPress:

1. Go to the ‘ administrations ‘ screen in WordPress. Click on the ‘ roles ‘ link.

3. Click on the ‘ add role ‘ button. Enter the name of the new user role in the ‘ add role name ‘ field. Enter the description of the new user role in the ‘ add role description ‘ field.

6. Select the privileges for the new user role in the ‘ add role responsibilities ‘ field. Click on the ‘ save changes ‘ button.

8. Click on the ‘ activate role ‘ button.

9. Enjoy your new user role!.