Last active
September 22, 2016 22:28
-
-
Save Temmyhlee/173860395faf875f787c579937d87997 to your computer and use it in GitHub Desktop.
Add media upload capability to contributor on WordPress
This file contains hidden or 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
<?php | |
//Do not add the line above | |
if ( current_user_can('contributor') && !current_user_can('upload_files') ) | |
//checks if the current user is a contributor | |
add_action('admin_init', 'allow_contributor_uploads'); | |
function tayo_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