Add_Role菜单页面不可见

时间:2014-12-03 作者:Sebastian Starke

我通过以下方式添加了自定义角色:

add_role( 
\'tabellenadmin\',
__( \'Tabellenadministrator\' ),
array(
    \'activate_plugins\' => true,
    \'delete_others_pages\' => true,
    \'delete_others_posts\' => true,
    \'delete_pages\' => true,
    \'delete_plugins\' => true,
    \'delete_posts\' => true,
    \'delete_private_pages\' => true,
    \'delete_private_posts\' => true,
    \'delete_published_pages\' => true,
    \'delete_published_posts\' => true,
    \'edit_dashboard\' => true,
    \'edit_files\' => true,
    \'edit_others_pages\' => true,
    \'edit_others_posts\' => true,
    \'edit_pages\' => true,
    \'edit_posts\' => true,
    \'edit_private_pages\' => true,
    \'edit_private_posts\' => true,
    \'edit_published_pages\' => true,
    \'edit_published_posts\' => true,
    \'edit_theme_options\' => true,
    \'export\' => true,
    \'import\' => true,
    \'list_users\' => true,
    \'manage_categories\' => true,
    \'manage_links\' => true,
    \'manage_options\' => true,
    \'moderate_comments\' => true,
    \'promote_users\' => true,
    \'publish_pages\' => true,
    \'publish_posts\' => true,
    \'read_private_pages\' => true,
    \'read_private_posts\' => true,
    \'read\' => true,
    \'remove_users\' => true,
    \'switch_themes\' => true,
    \'upload_files\' => true,
    \'update_core\' => true,
    \'update_plugins\' => true,
    \'update_themes\' => true,
    \'install_plugins\' => true,
    \'install_themes\' => true,
    \'delete_themes\' => true,
    \'edit_plugins\' => true,
    \'edit_themes\' => true,
    \'edit_users\' => true,
    \'create_users\' => true,
    \'delete_users\' => true,
    \'unfiltered_html\' => true
) 
);
据我所知,这个用户应该看到每个菜单页。但只显示仪表板和用户。我试图擦除函数中的所有内容。php,除上述内容外。没有变化。我错过什么了吗?

1 个回复
最合适的回答,由SO网友:Sebastian Starke 整理而成

问题是,我在创建角色后更改了功能。我注意到,如果我更改角色slug,角色就会重复。所以我找了找

remove_role( \'tabellenadmin\' );
将该行添加到Add\\u role()之前的某个位置。在更改角色之前,必须先删除该角色。

结束

相关推荐

Global functions on WPMU

我在一个多站点环境中工作,所有站点都是相关的。最近的许多发展都要求我将某些功能复制并粘贴到许多不同的主题文件夹中,如果我需要到处更新它们,就会出现问题。拥有全局“functions.php”文件的最佳方式是什么?我的想法是要么在themes文件夹中包含一个文件并包含它,要么创建一个插件并启用该插件。