在WordPress中添加新角色 [英] Adding New Role in WordPress

查看:168
本文介绍了在WordPress中添加新角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过以下代码在functions.php文件中添加了新角色:

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?

推荐答案

result = add_role(' supplier_for_planvent', __( ' Supplier_For_Planavent'), 大批( ' 阅读'=> true,//true允许此功能 ' edit_posts'=> true,//允许用户编辑自己的帖子 ' edit_pages'=> true,//允许用户编辑页面 ' edit_others_posts'=> true,//允许用户编辑其他帖子,而不仅仅是他们自己的帖子 ' create_posts'=> true,//允许用户创建新帖子 ' manage_categories'=> true,//允许用户管理帖子类别 ' publish_posts'=> true,//允许用户发布,否则帖子保持草稿模式 ));
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?


这篇关于在WordPress中添加新角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆