Created
July 25, 2019 13:30
-
-
Save versluis/76ebdf62fc24605e8ac15f519168ead0 to your computer and use it in GitHub Desktop.
adds file upload capabilities to the Contributor Role in WordPress
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
// add file uploads to Contributor role | |
function add_uploads_to_contribs () { | |
global $pagenow; | |
// grab contribtor role | |
$role = get_role ('contributor'); | |
// if this theme is activated, add the upload capability | |
if ('themes.php' == $pagenow && isset ($_GET['activated'])) { | |
$role -> add_cap ('upload_files'); | |
} else { | |
// remove when deactivated | |
$role -> remove_cap ('upload_files'); | |
} | |
} | |
add_action ('load-themes.php', 'add_uploads_to_contribs'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment