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:
- Prevent Direct Access Lite version 2.7.7 or greater
- Prevent Direct Access Gold version 3.3.3 or greater
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.
- Protected filenames: select files that you want to generate private download links for. Only protected files are displayed in the search results.
- 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.
- Download limit: define the number of times (clicks) that a private link can be used to download files. Leave blank for unlimited downloads.
- 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 );