Last active
October 30, 2018 14:42
-
-
Save nfsarmento/29f2a156ff7c42ef112f7af63502f9b4 to your computer and use it in GitHub Desktop.
WordPress: Allow Contributors to Upload Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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