Last active
September 11, 2022 09:57
-
-
Save terrytsang/06d1e9625172bf4ce4a75501273fc0de to your computer and use it in GitHub Desktop.
Enable contributor 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
<?php | |
//add this code into theme functions.php file | |
if ( current_user_can('contributor') && !current_user_can('upload_files') ) { | |
add_action('admin_init', 'allow_contributor_upload_image'); | |
function allow_contributor_upload_image() { | |
$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