How to give contributors the permission to upload media in WordPress

give contributors the permission to upload media in WordPress

WordPress offers different user roles and each role has different abilities. In multi-author blog, these user roles helps a lot. While these roles nice, I faced a problem with contributor role while working for my blog Techlomedia. Actually, I hired a writer and wanted him to contribute articles. But I didn’t want to allow him publish articles directly without my review. So, I added contributor role. In this role, contributor can publish post. Post will be sent to admin for review. But by default, Contributors can not add media files. This was the problem. I had to add images by myself in those posts. So, I searched for the solution and got few working ways. In this post, I am listing the solution.

Also read:

If you also want to allow contributors to upload and add images/videos in post, you can either do it manually or use any of available WordPress plugins. I am adding both manual way and plugin way in this post.

Manual way

Add the code given below 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');
}

 Plugin way:

If you are not sure how to edit theme files, you can use plugin to do it easily. User Role Editor is a nice WordPress plugin which makes it easy to update user roles and capabilities. You only need to select/deselect options and then save changes. You can also create new roles, select their capabilities according to your choice or copy an existing role.

WPFront User Role Editor is another WordPress plugin with similar kind of features. You can edit user roles, create new and delete roles.

I tried the manual way because I did not want to have an advance option. I just wanted to allow image upload for contributor and that code did that perfectly.

If you are facing any problem in implementing this, you can ask me via comments.

Tags: |

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.


Similar Articles

0 Comments

Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

2020 UseThisTip | Part of Techlomedia Internet Pvt Ltd Developed By Deepanker