Advertisement
fauzanjeg

Give Access to Upload File if Subscriber Cannot Upload Files

Mar 8th, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. /* Give Access to Upload File if Subscriber Cannot Upload Files */
  2. if ( current_user_can('subscriber') && !current_user_can('upload_files') ) {
  3.     add_action('init', 'allow_subscriber_uploads');
  4.    
  5.     function allow_subscriber_uploads() {
  6.         $new_role = get_role('subscriber');
  7.         $new_role->add_cap('upload_files', true);
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement