WordPress – give contributor permission to upload images without plugin.

WordPress contributor role lacks the permission to upload images.
There are a few plugins that can let you change role permissions, but I just needed to allow contributor role to upload images.

One minor change in the theme’s functions file is sufficient to give WordPress contributor role the permission to upload & insert images without plugin:

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');
}

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.