0

I have created a role in wordpress with add_role( string $role, string $display_name, array $capabilities = array() ) function I want to know witch Capability from the array of $capabilities will give it access to choose post template? the option is under Post Attributes section!

This is my code:

     $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 );
3
  • 1
    What do you mean by "choose post template"? That thing on the right (normal, video, link, ..)? I don't think there is an extra capability for that, people just need to be able to edit posts – kero Jan 2 '18 at 11:01
  • 1
    in editor role (the dropdown list that you can choose from costume post templates that i have created) don`t show the post template option but in admin role I have it! the option is under post attributes section – amin foroutan Jan 2 '18 at 11:03
  • there is no capabilities that allow page edition and deny template metabox. have you look in the screen options if the metabox is just hidden ? – mmm Jan 2 '18 at 20:34
1

A user with the capability of Create/Edit/Delete posts may access to choose post template.For more, please visit Roles and Capabilities

Hope this will helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.