Php WordPress中的新用户角色
我在我的functions.php文件中的WordPress中创建了新用户Php WordPress中的新用户角色,php,wordpress,Php,Wordpress,我在我的functions.php文件中的WordPress中创建了新用户角色(经理)。这是我的代码,但它没有功能。经理只阅读帖子,不能编辑和删除。怎么了 Thx 根据,您添加的角色不正确。据我所知,你的特权名称与我的名字都不匹配。在我看来,最好是通过插件添加 function add_mgr_role() { add_role( 'manager', 'Manager', array( 'read' => t
角色(经理)
。这是我的代码,但它没有功能。经理只阅读帖子,不能编辑和删除。怎么了
Thx
根据,您添加的角色不正确。据我所知,你的特权名称与我的名字都不匹配。在我看来,最好是通过插件添加
function add_mgr_role()
{
add_role(
'manager',
'Manager',
array(
'read' => true,
'edit_posts' => true,
'delete_posts' => true
)
);
}
register_activation_hook(__FILE__, 'add_mgr_role');
创建一个新的“经理”角色
很抱歉,但仍然无法使用它。用户只读取帖子。如果删除所有缓存,是否使用缓存插件。
function add_mgr_role()
{
add_role(
'manager',
'Manager',
array(
'read' => true,
'edit_posts' => true,
'delete_posts' => true
)
);
}
register_activation_hook(__FILE__, 'add_mgr_role');
$result = add_role(
'manager',
__( 'Manager' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => true, // Use false to explicitly deny
)
);
if ( null !== $result ) {
echo 'New role created!';
}
else {
echo 'Manager role already exists.';
}