Custom user role not working as expected

Question

I’ve defined a custom user role in functions.php called “Dashboard Admin” with the capabilities defined below. The site has a number of custom post types- all with capability post– and I’d basically like to lock down this role’s capabilities to only creating/editing/deleting posts (of any type), and not pages, managing categories or any other higher level admin tasks. For some reason, using the array below, when logging in as this user type one can only create new posts and “Submit for review” and not open or edit any existing posts of any post type- what am I missing here? Thanks in advance!

$result = add_role(
    'dashboard_admin',
    __( 'Dashboard Admin' ),
    array(
        'read'                   => true,
        'publish_posts'          => true,
        'edit_posts'             => true,
        'edit_others_posts'      => true,
        'edit_published_posts'   => true,
        'delete_posts'           => true,
        'delete_others_posts'    => true,
        'delete_published_posts' => true,
        'read_private_posts'     => true,
        'edit_private_posts'     => true,
        'delete_private_posts'   => true,
        'upload_files'           => true,
        'publish_pages'          => false,
        'edit_pages'             => false,
        'edit_others_pages'      => false,
        'delete_pages'           => false,
        'delete_published_pages' => false,
        'delete_others_pages'    => false,
        'manage_categories'      => false,
        'install_plugins'        => false,
        'activate_plugins'       => false,
        'update_plugins'         => false,
        'edit_plugins'           => false,
        'delete_plugins'         => false,
        'edit_dashboard'         => false,
        'switch_themes'          => false,
        'edit_theme_options'     => false,
        'create_users'           => false,
        'list_users'             => false,
        'edit_users'             => false,
        'delete_users'           => false,
        'promote_users'          => false,
        'remove_users'           => false,
        'customize'              => false,
        'manage_options'         => false,
        'delete_site'            => false,
        'import'                 => false,
        'export'                 => false,
    )
);
0
nickpish 4 months 0 Answers 20 views 0

Leave an answer