Skip to main content
6 of 6
Restore the wphardcore article from archive.org, since it was listed as a reference for the answer. Although I'll leave the kinsta link too.
Rup
  • 4.4k
  • 4
  • 28
  • 29

This is what you may want to do (add the following code to your theme functions.php file or a custom plugin):

function add_custom_role() {
    global $wp_roles;
    
    $custom_capabilities = array(
        'read', 'edit_posts', 'upload_files',
        'read_private_pages', 'edit_private_pages', 'read_private_posts',
        'edit_private_posts', 'edit_published_pages', 'edit_others_pages',
        'edit_pages', 'edit_published_posts', 'edit_others_post',
        'unfiltered_html', 'manage_options'
    );

    $wp_roles->add_role( 'custom_role', 'Custom Role', $custom_capabilities );
}

add_action( 'init', 'add_custom_role' );

References:

https://wordpress.org/support/article/roles-and-capabilities/

http://www.wphardcore.com/2010/ultimate-guide-to-roles-and-capabilities/

and a more modern article from a suggested edit:
https://kinsta.com/blog/wordpress-user-roles/

sorich87
  • 8k
  • 36
  • 28