Home Blog How To Allow a Contributor To Upload Media File In WordPress
WordPress Guides · October 11, 2018 · 3 min read

How To Allow a Contributor To Upload Media File In WordPress

Mohammad Saiful Islam
WPExtent
How To Allow a Contributor To Upload Media File In WordPress

As we know that by default WordPress doesn’t allow a contributor to upload media files.
But an Author or Editor can upload media files in a WordPress site. You can surely upgrade an account from Contributor to Editor or Author.
This code is only for that time if you want to allow your contributor to upload media files. You can simply copy and paste the code functions.php file of your Theme.

// let’s check this user is contributor or not first
//we can also check this user has access to upload files or not
$user = wp_get_current_user();
 if ( in_array( ‘contributor’, $user->roles  ! current_user_can(‘upload_files’) ) {
   function webextent_allow_contributor_upload_files(){
    $role = get_role( ‘contributor’ );
    $role->add_cap( ‘upload_files’);
  }
  add_action( ‘admin_init’,  ‘webextent_allow_contributor_upload_files’ );
}

Note: This will apply to all of the contributors to your site.

If you would like to give access to a particular user then you can follow the next method.
We will use user ID and will match a particular user-ID with the current user id. If you don’t know how to collect a user ID then you can look at the below how I did it.

How to allow a contributor to upload media files ( only for particular users).

// let’s check this user is contributor or not first
//we can also check this user has access to upload files or not
$user = wp_get_current_user();
$user_id = 12; // collect the user id of the user
$current_user_id = $user->ID;
if ( in_array( ‘contributor’, $user->roles && $user_id == $current_user_id ) {
  function webextent_allow_contributor_upload_files(){
   $role = get_role( ‘contributor’ );
   $role->add_cap( ‘upload_files’);
 }
 add_action( ‘admin_init’,  ‘webextent_allow_contributor_upload_files’ );
}

How to collect a specific user ID.

If you would like to collect a specific user ID to allow a contributor to upload media files ( only for a specific user ). Then you can look at the below. It’s too easy.

First of all, you’ll need to go to users and then go to All users.  So if you would like to get any user ID what you’ll need is to hover on Edit button and you’ll see a link will appear.

It’ll be at the bottom of the page. So you’ll see there is a tag called ‘user_id’ and user ID will appear there. You’ll need to just take that ID. That’s it.

So collecting and User ID to allow a contributor to upload media file is to easy.

If you’re looking for to know more about WordPress default users and their permissions then you can look at it here: WordPress User Roles And Their Permissions

Share:
𝕏 Twitter in LinkedIn

Leave a Reply

← Previous Post How To Choose Best WordPress Theme. Next Post → How To add age verification in WordPress Website.
You Might Also Like
Why WordPress Updates Matter More Than Most Website Owners Realize
May 11, 2026 WordPress
Why WordPress Updates Matter More Than Most Website Owners Realize

FacebookTweetPinLinkedIn Most websites don’t crash overnight. They quietly fall apart while no one is watching. For thousands of business owners, that slow collapse begins with a single ignored…

Essential Accessibility Tweaks Every WordPress Site Needs Right Now
May 7, 2026 WordPress Guides
Essential Accessibility Tweaks Every WordPress Site Needs Right Now

FacebookTweetPinLinkedIn Why WordPress Accessibility Matters More Than Ever Web accessibility has evolved from a “nice-to-have” feature into a business necessity. Yet over 96% of websites fail basic accessibility…

Stay in the WPExtent Loop

New articles on WordPress, SEO and digital growth — every week.

Discover more from WPExtent

Subscribe now to keep reading and get access to the full archive.

Continue reading