Allow Contributor to upload images in WordPress


In WordPress, there are various roles. The Contributor role is very simple. A person having this role can write and edit their own posts, however they cannot publish them. Their posts need to be checked and approved by someone with more authority or power, like an Editor or Administrator. Contributors also cannot upload pictures or files to the site. This role is useful for administrators, when they want people to share ideas or articles, but still keep control over what gets published. It helps teams work together while making sure the site stays safe and well-managed.

Add media button missing for Contributor's role
Add media button missing for Contributor’s role.

As we mentioned earlier Contributors can’t upload image, as they don’t have Add media button. The images are key components for an article or post. But since Add media button is not there, these may happen:

  • Posts without images often look very plain and less engaging from user engangement point of view.
  • Having images in the article, makes them more interesting and easier to read.
  • With no upload rights, Contributors should rely on editors to add images, which slows down the publish process.

Allow Contributor to upload images in WordPress

In order to allow Contributors to upload images, you can add a short code to your 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');
    $contributor->add_cap('upload_files');
}

Once you add this code, the Contributor can see the Media option in left pane of WordPress interface. They will be now seeing the Add media button in post editors. Contributors can edit or delete their own images but they can only view images uploaded by others, not edit or delete them.

Media option visible in left pane, Add media button now visible in post editor.
Media option visible in left pane, Add media button now visible in post editor.

To revoke the capability to media upload by Contributors, administrators can simply remove the above shared code they added to functions.php file.

Summary


Contributors in WordPress usually cannot upload images, but with a small code change, administrators can give them this ability. This makes their posts more engaging and saves editors or administrator’s time.