How to Password Protect Files Embedded in Content Sections

Password Protect WordPress (PPWP) Pro gives you the ability to protect the files already embedded in content by simply wrapping them with a shortcode.


Step-by-step to password protect files

Step 1: Protect a file with PDA Gold

There are many ways to protect your private files with PDA Gold plugin. One of them is simply ticking “Protect this file” checkbox while editing.

Step 2: Insert that file into content

Currently, our plugin just protects all files inserted in <a> tag.

So if you want to protect an image or a video, you should use “File” block in Gutenberg editor. It will automatically insert these types of files in <a> tag format.

In case you are using Classic Editor, please copy this code snippet to your content.

<a href="your-file-URL"> Your file name </a> 
You file URL will display under “Copy Link” field

Step 3: Wrap that file with PPWP shortcode

Similar to password protect a part of content, you need to wrap your protected file with our PPWP shortcode. You can optionally add some description above the shortcode for introduction.

Put some description here (optional)
[ppwp passwords=123 headline= "Protected File" Description ="Enter password to unlock and download this file" cookie=1 download_limit=1] 
<a href="your-file-URL"> Your file name </a> 

Once publish, your content will look like this:

In this example, if users enter right password (123), they will be able to see the file and download it once.

Addition attributes

Set cookie expiration time. After that, users have to re-enter passwords.

  • Count by hours
  • It must be positive integer and no more than 8760
  • Get cookie value from the shortcode in which users entered password
    • If this attribute is empty, our plugin will get cookie value from settings page
    • Default value: 168 hours (7 days)


Set the maximum number of times users can download a file wrapped under shortcode.

  • Count by clicks
  • It must be positive integer and no more than 8388607
  • Default value: 1 click
Please note that these attributes won’t work without PDA Gold. Make sure you’ve installed and activated PDA Gold before setting them.

How does it work?

Once users enter correct passwords, our plugin will auto-generate a self-expiring private link per file. The links will automatically expire after a given download time. Your customers can see and download your protected files but cannot share file URLs with other people.

  • The same file URLs will return to the same download private links under one shortcode. In other words, if you insert a pdf file multiple times under one shortcode, our plugin will replace this file with one private download link. Clicking on one link will decrease the download limit of the others.
Lasted updated on April 27, 2021