WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So this other day I was trying to get a new functionality to work for a client's website. Unique download URLs for each time a new visitor clicks on a specific button in Wordpress

How would the whole thing work:

Let's say I have a button on the left widget area of my website that says "Download Ebook Now".

-I need each visitor to be redirected to a unique URL ( that will expire after x amount of time) -On the separate page , the download link will be provided as normal

Do you happen to know if there is a plugin or script out there that could handle such a task or another solution to go about implementing this?


share|improve this question

If you want to use Amazon S3 to host the downloadable files, the ability to generate unique expiring URLs is a feature of the S3 API.

share|improve this answer

I would personally use Amazon S3 as suggested which has support for unique expiring URL's. Sites like Net Tuts use this approach for their paying members wanting to download premium files. If you don't want to go down that route, it's rather easy to implement something simple.

You basically want to generate a unique token by adding a row to a table with an expiration time. When a user accesses the URL with said token, you pull out the date and then compare it to the current date, if it has been 24 hours since created for example. than either flag or delete the code.

Getting the URL's to work with Wordpress however will require you look into the WP_Rewrite class to add in custom rewrite URL's for this functionality. As for the unique codes, I'd just MD5 the current date and time to create unique codes and maybe append a random number at the end using rand.

share|improve this answer

You could use page that has the PDF embedded in it which would interact with wordpress's user system and only load if the user is logged in and authorized.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.