How To Protect Media Library Files

How To Protect WordPress Media Library Files?

Whether you are selling your digital products online or running a website, security is a major issue for site owners. Sometimes you don’t allow some visitors from downloading, sharing, and copying your media or attachment without permission.

For instance, if you have built some media files or attachments only for your premium users or some specific users then you have to protect those files from being leaked out.

So, what can you do to protect your media file?

Well, In this article, we will explain how you can protect your files from unauthorized access.

Special Note:
For now, it will only work with the apache server, as the protection is handled by .htaccess rules

So, let’s get started!!

How To Protect WordPress Media Library Files?

The WordPress Download Manager Pro Plugin Provides you various options to protect your media files. It offers you all the features you will ever need to manage your files and documents and restrict them from unauthorized users using passwords. You can protect your new file when you upload it under the WordPress media library. On the other hand, you may protect those media files while you are editing a page or post.

To protect your media file with WordPress Download Manager Pro you have to follow some easy steps which are given below –

Step 1: 

First of all, you have to purchase the pro version. After purchasing you need to download the plugin and install it on your WordPress dashboard. You may check the installation guide of the WordPress Download Manager Pro version. After installing now you have to activate it to protect your site as well as your media library files.

Step 2:

Once you have activated the plugin, now head over to Media →  Add new from your dashboard to protect new media or go to Media → library to protect the already uploaded media files. 

media library file on wordpress dashboard

Step 3:

After uploading a media file or clicking on the media files, you may see a button named protect this file. Now you have to click on the button.

WordPress Media File Protection

Step 4:

Once you have clicked on it you will see various options appear on the right side of the attachment details interface such as Password, Allow Access, and Shortcode. We will explain each of the features below:

WordPress Media File Protection - Access Control Options


This Password option offers you to set a password for this media. You can set a unique password for each file as you want.

Allow Access:

This option lets you select user roles (public, Subscriber, Contributor, Author, Editor) which can directly access your privately protected files. Here, you may choose many users’ roles at a time for accessing the media.


This shortcode option lets you do your work with little effort. Now you do not need to upload the media and set the password when you need it. You just use the shortcode on your post or page when you require it, this shortcode automatically takes all the restrictions for this media.

Step 5:

After setting all the options, now you need to click the button Apply Restrictions to set all restrictions you have done for this media. Once you have clicked the button you will view a similar interface-

enable restrictions for this media

After clicking the button, now your file is protected from unauthorized users. 


That’s all. Now protecting your WordPress media file is easy with our WordPress Download Manager Pro Plugin. It does not matter how many files you want to protect or what is the format of those files.

We hope this article will help you to learn how to protect your WordPress media library files against unwanted users. You may also ask any questions you have in the comment or want us to write on some specific topics you have in your mind.

If this article will help you, then please subscribe to our YouTube channel to get more tutorials related to WordPress. You may join our Facebook page to update yourself with more tips, solutions, offers and so on.

We appreciate your further comments, support or suggestions!

Leave a Reply