Do you want to allow contributors to upload images without providing them with the ability to delete other images in WordPress? Follow our instructions to allow image uploads for contributors.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
<?php //allow contributor to add photos 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'); } } ?>
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: Best WordPress Page Builders (Compared).
[code]add_cap('upload_files');
}
}
?>[/code]
Comments Leave a Reply