allow wordpress contributors to upload files

There are some pre-installed user roles in wordpress. I am trying to allow wordpress contributors to upload files. I have many requests for guest author writers. I give the contributors role to them. But I faced one issue. which is I cannot allow wordpress contributors users to upload image files.

allow wordpress contributors to upload files

I want to achieve following two things:

  1. I want to allow wordpress contributor users to allow images for their posts and preferably they shouldn’t be able to delete existing ones before submitting it for review.
  2. I want to article should be in draft state but it cannot be edited by contributor users.

For image upload option to contributors

Add this code in your current theme’s 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');
}

This is easy trick but their is more advanced solution. You can use Members wordpress plugin. This plugin solve our issue more easily.

Members is a plugin that extends your control over your blog. It’s a user, role, and capability management plugin that was created to make WordPress a more powerful CMS.

It puts you in control over permissions on your site by providing a user interface (UI) for WordPress’ powerful role and cap system, which is traditionally only available to developers who know how to code this by hand.

I personally used this plugin for some of my wordpress projects. It is my favorite wordpress plugin which will open new doors to wordpress. I think this plugin should be wordpress core.

Add a Comment

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