I'm creating a WordPress blog with some members-only page. In those members-only posts I have my own tutorial download links which i have uploaded for FREE. Problem is I want them to stop sharing the download link for the tutorials, instead of that I want to give them links which will only works once OR It will only work when it is accessed from mydomain.com ..

Can anyone help me? any idea would be much appriciated.


  • I believe that the Wordpress 'Download Manager' plugin might solve your problem!
    – Matt
    Dec 27, 2012 at 7:37

2 Answers 2


This sounds like something that eCommerce plugins should be able to handle.

My naive approach to this problem can be to generate a new URL each day by embedding the date in it and then checking with the date in the URL matches the current day before sending the file.

You will need a plugin that gives you the ability to use a shortcode to rmbed the URL, and checks the validity of it before sending the file.

// files assumed to reside at wp-content/uploads/daily

// use the shortcode like that
// [daylyurl file="file name" anchor="download it"]


function my77348_dailyurl($attr,$content='',$tags) {
  $url = get_option('siteurl').'?download='.$attr['file'].'&code='.md5(intval(time()/24*60*60));
  return "<a href="$url">$attr['anchor']</a>";

// handle the download itself


function my77348_download() {
  if (isset($_GET['download'])) {
    if ($_GET['code'] == md5(intval(time()/24*60*60))) { // if it match it is legit
      $f = ABSPATH.'/wp-content/uploads/daily/'.$_GET['download'];
      // not sure if you can set mime types here or need to do all of this before init
      readfile($f); send the file itself
    } else
      wp_die(404); // not legit

This is not a production grade code as there are many sanity checks I omitted, and probably has a bug or more, but I think the concept should work as long as your members don't have a big incentive to try to hack it.

  • 1
    @e4rthdog, not sure what you are trying to say 1. as explicitly stated this is a sketch of how a solution can be written, not an "copy & paste" ready code. 2. md5 is always the same for a specific day. Jun 1, 2016 at 7:54
  • You are correct. I thought we were checking exact time. Sorry ...
    – e4rthdog
    Jun 1, 2016 at 8:16

I have written the plugin WP DISPATCHER that creates temporary download links where you can also set the expiration time.

You can download for free from WP Plugin Repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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