How to allow contributors to upload images In WordPress

By default, WordPress doesn’t allows contributors to upload media attachments. However, you can easily fix this problem by dropping a small amount of code to your functions.php file.

To allow contributor to upload media attachments copy the following code and paste it inside your functions.php directory.

//Allow Contributors To Upload Images In WordPress
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');
}

 

0 Comments

Leave a Comment.