How To Allow Contributors To Upload Images In WordPress

Yesterday I posted an article about allowing your WordPress website’ users to post on your website at this link. If you choose contributor role as the default role for your users, then you should know that the users with contributor roles are not allowed to upload images to their WordPress posts. If you want to allow contributors to upload images in WordPress, then here’s a little snippet for that.

Add following snippet to your current theme’s functions.php file:

if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');

function allow_contributor_uploads() {
     $contributor = get_role('contributor');

17 thoughts on “How To Allow Contributors To Upload Images In WordPress”

  1. I just tested this, and it worked perfectly. However, it gives the contributors the ability to delete their own images even after the posts are published, which isn’t a good idea in my opinion. Any workaround to deal with this?

      1. I added it, but the contributors are still able to delete images from the media library. When a contributor accesses the media library, they still see the Edit | Delete Permanently | View links. They sure can’t edit the post itself though (which is the case with or without the $contributor->remove_cap(‘edit_files’); bit).

        1. I found another snippet that does just that, I’ll put it here so people with the same problem will find a solution:

          add_action('media_row_actions','users_own_attachments', 2, 1);
          function users_own_attachments( $wp_query_obj ) {
          if( !current_user_can( 'delete_plugins' ) ){
          return $wp_query_obj;

          Thank you, this article have been a great help!

          1. Actually, and according to my test, the snippet hides the red “Delete Permanently” link for everyone, including admins (from Media Library). However, contributors still can select pictures they uploaded and bulk delete them through the bulk command list. So I guess the problem still persists, I was quick to the trigger there :D

Leave a Reply to Online Rockers Hub Cancel reply

Your email address will not be published. Required fields are marked *