Skip to content

Instantly share code, notes, and snippets.

@nfsarmento
Last active October 30, 2018 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfsarmento/29f2a156ff7c42ef112f7af63502f9b4 to your computer and use it in GitHub Desktop.
Save nfsarmento/29f2a156ff7c42ef112f7af63502f9b4 to your computer and use it in GitHub Desktop.
WordPress: Allow Contributors to Upload Images
/** WordPress: Allow Contributors to Upload Images
*
* https://www.nuno-sarmento.com
*/
if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'ns_allow_contributor_uploads');
function ns_allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor->add_cap('upload_files');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment