Advertisement
fauzanjeg

Disable Media Buttons Except Administrator

Jun 15th, 2021
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. /** Disable Media Buttons Except Administrator */
  2. function disable_media_buttons() {
  3.     $user = wp_get_current_user();
  4.     if ( ! in_array( 'administrator', (array) $user->roles ) ) {
  5.         remove_action( 'media_buttons', 'media_buttons' );
  6.     }
  7. }
  8.  
  9. add_action( 'init', 'disable_media_buttons' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement