简体   繁体   中英

Adding New Role in WordPress

I have added new role in functions.php file by this code:

// Add a custom user role

$result = add_role( 'supplier_for_planvent', __(
'Supplier_For_Planavent' ),


array(

    'read' => true, // true allows this capability
    'edit_posts' => true, // Allows user to edit their own posts
    'edit_pages' => true, // Allows user to edit pages
    'edit_others_posts' => true, // Allows user to edit others posts not just their own
    'create_posts' => true, // Allows user to create new posts
    'manage_categories' => true, // Allows user to manage post categories
    'publish_posts' => true, // Allows the user to publish, otherwise posts stays in draft mode

));

But when I log-in through new role account, I got this message:

You do not have sufficient permissions to access this page.

Can anyone help me?

I dont like using plugins for simple stuff, but i always prefer using plugins for user roles as sometimes it becomes very tricky. Try using "User Role Editor".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM