Reputation: 71
How do I restrict registered users with editor role, from the Media Library upload file?
I have changed permission on the upload.php file but that does't work.
any help?
Upvotes: 0
Views: 53
Reputation: 11808
function remove_file_upload_cap_editor(){
$role = get_role( 'editor' );
$role->remove_cap( 'upload_files' );
}
add_action( 'admin_init', 'remove_file_upload_cap_editor');
A better way would be to do this on plugin or theme activation as the values are saved in the database (if adding the code in a plugin). e.g.
register_activation_hook( __FILE__, 'remove_file_upload_cap_editor' );
Upvotes: 1
Reputation: 2568
Use a user role plugin, for example the excellent User Role Editor.
Upvotes: 1