Title: Add new role programmatically
Last modified: April 12, 2017

---

# Add new role programmatically

 *  [lkits](https://wordpress.org/support/users/lkits/)
 * (@lkits)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/add-new-role-programmatically/)
 * Hey!
 * Is it possible to add new role programmatically? With some PHP function?
    Maybe
   check if role already exists, if not, clone some existing role etc.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * (@shinephp)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/add-new-role-programmatically/#post-9036107)
 * Hi,
 * Yes, it’s possible.
 *     ```
       add_role('new_role_id', 'New Role Name', array('read'=>'true'));
       ```
   
 * Look in wp-includes folder at capabilities.php, class-wp-roles.php, class-wp-
   role.php for more information about related API available at WordPress core.

Viewing 1 replies (of 1 total)

The topic ‘Add new role programmatically’ is closed to new replies.

 * ![](https://ps.w.org/user-role-editor/assets/icon-256x256.jpg?rev=1020390)
 * [User Role Editor](https://wordpress.org/plugins/user-role-editor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-role-editor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-role-editor/)
 * [Active Topics](https://wordpress.org/support/plugin/user-role-editor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-role-editor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-role-editor/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/add-new-role-programmatically/#post-9036107)
 * Status: not resolved