Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Restrict Uploads to Specified File Types Only in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Restrict Uploads to Specified File Types Only in WordPress

Few days ago while working on a client’s site, we were asked to code a function that restrict uploads to specified file types only (jpg, gif, png). After looking around the repository and finding nothing that can do this, we decided to create a plugin of our own. Yesterday, it was approved in the WordPress plugin repository and it is called Restrict Uploads.

Unlike other plugins, this plugin does NOT have a super complex settings panel. As a matter of fact, it doesn’t have any settings panel at all. It is built to do one thing and one thing only. That is to keep your editors from uploading any other file type aside from images (jpg, gif, png). Plugins like these are the ideal type because it works silently in the background having no impact on your site’s load time, or your day to day activity.

All you have to do is simply install and activate the plugin. Download Restrict Uploads Now.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Yulian says:

    Really nice plugin!! Save me time!! Thanks!

  2. wpbeginner says:

    @susan suarez Yes you are correct. This will prevent any malicious entry using the wp-admin to upload stuff using the media uploader…

  3. truecalorie says:

    Very handy – thanks for adding this. Would this also help with the security of the plugin? So that if a hacker got in, they couldn’t upload any other type media file?

  4. Debajyoti says:

    @wpbeginner You’re right…. I wanted to focus on .JPG, .PNG and .GIF in capital… coz they can’t be uploaded. Some image editors save in capitals…

  5. wpbeginner says:

    @Debajyoti Then there would be no point of having this plugin. The whole idea is to keep the editors from uploading any other file type aside from images. We will work on an improvement for this plugin that will let you pick which users to limit the stuff for though :)

  6. Debajyoti says:

    You might also add .zip and .txt and .JPG, .PNG, .GIF to the filter.

  7. wpbeginner says:

    @JasonDittmer Yea I love plugin like these myself. Because they don’t require you to do anything. It is for one thing only.

  8. JasonDittmer says:

    I was expecting to read about how I had to write a bunch of code to make this work. Thanks for the simple plugin. Nice quick fix!

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 comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.