Restrict file type uploads by user name

Adding this snippet to the functions.php of your worpress theme will let you restrict file uploads by type for specific users only. When a username is not in the users array they will only be able to upload jpg, and gif images.



function restrict_mime($mimes) {
global $current_user;
// change users in list
$users = array(
if (!in_array($current_user->user_login, $users)) {
$mimes = array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
return $mimes;

Leave a comment