How To Allow Contributor User Role Upload Images
One of the many questions people asked me is how do you allow a contributor in WordPress to upload images and files.
The Contributor User Role allows you to write a post and submit it for pending review by the Administrator to approve and publish. That’s by default and the big disadvantage here is that you don’t have the ability to upload images or files in the post.
There is a way. Add the following code to the file functions.php:
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');
$contributor->add_cap('upload_files');
}
That’s it. Now your Contributors should be able to upload images or files in the post and submit it for pending review.
Hope this helps. =D

Very good, thank you very much
pippo
February 12, 2011 at 4:09 pm
I added this code to the functions.php file in my template and it did work. But, I decided I didn’t want to have the image upload ability anymore for contributors. I deleted the code, but the upload icons are still there. Now, how do to remove the ability to upload images for contributors? I need those upload icons removed. Please help!
Phil
March 30, 2011 at 8:50 am
That’s a good question. I have not come up with the solution but perhaps soulsizzle will be looking into this problem as the code originated from him.
I was searching for clues and answers and I found this link – http://www.nouveller.com/quick-tips/quick-tip-9-change-the-default-capabilities-of-wordpress-users-with-ease/ by Benjamin Reid. I’ve tried his method hoping to remove the icons but the icons are still there.
If anyone else can come up with a solution, please contribute to help.
Yahya Ayob
March 30, 2011 at 11:38 pm
Yahya,Thanks for the response.
After hours of trying to write code to remove this I was unsuccessful. The best solution I came up with was just to go into the database and remove the ‘file upload’ for contributors. Do a SQL command: SELECT * FROM wp_options WHERE option_name=”wp_user_roles”
Find: s:11:”contributor”;a:2:{s:4:”name”;s:11:”Contributor”;s:12:”capabilities”;a:6:{s:10:”edit_posts”;b:1;s:4:”read”;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;s:12:”upload_files”;b:1;}}
Replace with:
s:11:”contributor”;a:2:{s:4:”name”;s:11:”Contributor”;s:12:”capabilities”;a:5:{s:10:”edit_posts”;b:1;s:4:”read”;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;}}
This should remove this. Worked for me.
Phil Ginsburg
April 11, 2011 at 7:11 am