Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. $role = get_role( 'author' );
  2. $role->remove_cap( 'upload_files' );
  3.  
  4. <?php
  5. /**
  6. * Plugin Name: Admin Only Uploads
  7. * Description: Prevents Uploads from non-Admins
  8. * Author: TJNowell
  9. * Author URI: http://tomjn.com
  10. * Version: 1.0
  11. */
  12.  
  13. function tomjn_only_upload_for_admin( $file ) {
  14. if ( ! current_user_can( 'manage_options' ) ) {
  15. $file['error'] = 'You can't upload images without admin privileges!';
  16. }
  17. return $file;
  18. }
  19. add_filter( 'wp_handle_upload_prefilter', 'tomjn_only_upload_for_admin' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement