Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
adds file upload capabilities to the Contributor Role in WordPress
// 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
You can’t perform that action at this time.