Hello guys, If you created the “contributor” user role in your WordPress blog, and your writer needs to upload images too but they can’t, Because the WordPress contributor user role lacks the permission to upload images, there are a few plugins that can let you change role permissions, but here in this WordPress Tutorial, we are going to share a simple step to give contributors permission to upload images without a plugin.
WordPress Tutorial to Allow Contributors Upload Images
One minor change in the theme’s functions file is sufficient to give WordPress contributors the permission to upload and insert images without using any plugin.
1: First login to your cPanel and go to File Manager. And access your domain files.
2: Next you go to wp-content>Themes>your-themes>functions.php. and add bellow code in bottom of functions.php file.
if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'wif_allow_contributor_uploads');
function wif_allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor->add_cap('upload_files');
}
Thats it, now contributor has access to media library and upload permission.