0

I need to give access to "Editor" role, to be able to read and edit all users' media attachments. I found that a plugin can do this: https://wpfront.com/user-role-editor-pro/media-attachment-file-permissions/ .

Any ideas how to achieve this without using a plugin?

1

As far as I know there's no standard capabilities just for attachments. You'd need edit_posts.

function add_theme_caps() {
    $role = get_role( 'editor' );
    $role->add_cap( 'edit_others_posts' ); 
}
add_action( 'admin_init', 'add_theme_caps');
3
  • By defaults, editor role already has capability to "edit_others_posts". I need the editors to be able to add feature image from images/media library (that already uploaded by admin and/or other users) when they edit other user's post. – Malvyn Dec 14 '16 at 4:59
  • Aren't they allowed that by default too? I think edit_others_posts takes care of that. You could try the upload files capability too, but I think that's a default for editors as well. – Pim Dec 14 '16 at 5:44
  • Yes, the upload files capability is enabled by defaults for editors role. And yet the media/images files shown in the library are only the ones that uploaded by themself. – Malvyn Dec 14 '16 at 23:31

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.