能够选择帖子/页面模板

时间:2018-01-02 作者:amin foroutan

我在wordpress中创建了一个角色add_role( string $role, string $display_name, array $capabilities = array() )函数我想从$capabilities 是否允许其选择帖子模板?该选项位于“发布属性”部分下!

这是我的代码:

     $capabilities = array(
"activate_plugins" => false,
"create_users" => false,
"delete_themes" => false,
"delete_users" => false,
"edit_files" => false,
"edit_plugins" => false,
"edit_theme_options" => false,
"edit_themes" => false,
"edit_users" => false,
"export" => false,
"import" => false,
"install_plugins" => false,
"install_themes" => false,
"list_users" => false,
"manage_options" => false,
"promote_users" => false,
"remove_users" => false,
"switch_themes" => false,
"update_core" => false,
"update_plugins" => false,
"update_themes" => false,
"edit_dashboard" => false,
"customize" => false,
"delete_site" => false,
"moderate_comments" => false,
"manage_categories" => false,
"manage_links" => false,
"edit_others_posts" => true,
"edit_pages" => false,
"edit_others_pages" => false,
"edit_published_pages" => false,
"publish_pages" => false,
"delete_pages" => false,
"delete_others_pages" => false,
"delete_published_pages" => false,
"delete_others_posts" => true,
"delete_private_posts" => true,
"edit_private_posts" => true,
"read_private_posts" => true,
"delete_private_pages" => false,
"edit_private_pages"=> false,
"read_private_pages" => false,
"unfiltered_html"=> false,
"edit_published_posts"  => true,
"upload_files" => true,
"publish_posts" => true,
"delete_published_posts" => true,
"edit_posts" => true,
"delete_posts" => true,
"read" => true);
 add_role( "parisa", "parisa", $capabilities );

1 个回复
SO网友:Sunil Dora

具有创建/编辑/删除帖子功能的用户可以访问选择帖子模板。欲了解更多信息,请访问Roles and Capabilities

希望这对你有帮助。

结束

相关推荐

如何解决1145行/wp-includes/capabilities.php中的通知:未定义的偏移量:0

我已经看过这个问题的以前的例子,但根据我从其他人那里看到的情况,我找不到导致这个通知的解决方案。当我添加新帖子时,这会出现在屏幕顶部。1145是:$post = get_post( $args[0] ); 我没有收到任何其他类型的错误,因此我不确定这是在我的代码中导致问题的地方。Any help on this?代码如下://show metabox in post editing page add_action(\'add_meta_boxes\', \'kk_add_metabox\