How to Bulk Generate Private Download Links

Generating some download links once by once wouldn’t take you much time. But keep doing so for, let’s say, more than 100 private download links for each protected file matters.

It’s when you need a function that allows you to auto-generate multiple download links for all selected protected files at once.

Fortunately, now you can achieve that with our “Bulk Generate Private Links” function.

Let us walk you through a step-by-step guide shortly!

Requirements:

Protect Media Files with PDA Gold

First and foremost, you need to protect your files under the Media Library.

You can refer to our documentation showing 4 different ways to protect your files.

Bulk Generate Private Download Links

Navigate to Prevent Direct Access Gold > Tools > Private links tab under your admin dashboard.

A new screen displays where you can configure settings for private links that will be generated.

PDA Gold: Bulk generate private links

  1. Protected filenames: select files that you want to generate private download links for. Only protected files are displayed in the search results.
  2. Number of private links per file: define the number of private links to be generated of each file. We recommend generating less than 10000 links at once to avoid request timeout. Otherwise, you need to increase your server’s execution time.
  3. Download limit: define the number of times (clicks) that a private link can be used to download files. Leave blank for unlimited downloads.
  4. Download expiry: select the time when generated private links will expire. Leave blank for no expiry.

Increase Execution Timeout

In case you want to generate a huge number of private links, you might need to increase the default execution timeout to prevent request timeout. To do so, simply add the following code snippet to your (child) theme functions.php file.

add_filter(
    'pda_request_timeout',
    function ($timeout) {
        return 30000; /*30 seconds*/
    },
    10,
    1
    );

 

Lasted updated on December 18, 2021