Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $role = get_role( 'author' );
- $role->remove_cap( 'upload_files' );
- <?php
- /**
- * Plugin Name: Admin Only Uploads
- * Description: Prevents Uploads from non-Admins
- * Author: TJNowell
- * Author URI: http://tomjn.com
- * Version: 1.0
- */
- function tomjn_only_upload_for_admin( $file ) {
- if ( ! current_user_can( 'manage_options' ) ) {
- $file['error'] = 'You can't upload images without admin privileges!';
- }
- return $file;
- }
- add_filter( 'wp_handle_upload_prefilter', 'tomjn_only_upload_for_admin' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement