fauzanjeg

Change Limit Size File Uploads

Dec 10th, 2020 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. /* For Change Limit Size File Uploads */
  2. function increase_upload_size_limit() {
  3.     $user = wp_get_current_user();
  4.     $roles = (array) $user->roles;
  5.  
  6.     if ($roles[0] == 'administrator') {
  7.         return 1048576 * 15; // 15 MB
  8.     }
  9.  
  10.     if ($roles[0] == 'editor') {
  11.         return 1048576 * 4; // 4 MB
  12.     }
  13.  
  14.     if ($roles[0] == 'author') {
  15.         return 1048576 * 4; // 4 MB
  16.     }
  17. }
  18.  
  19. add_filter( 'upload_size_limit', 'increase_upload_size_limit', 99 );
Add Comment
Please, Sign In to add comment