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;

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!