To explain further, here's what I"m looking to do:

  1. Create a WP page
  2. Use the URL and implement it in a reader service that is hosted (not downloadable) that in order to read (& access the URL) you would have needed to purchase a subscription.
  3. Allow only visitors coming in from the guide access to the page (would be invisible if user clicked on it and tried accessing it from a different location)

To simplify this explanation, I'm looking for a way to only give access to a specific URL from a specific URL.

What would be the best route to take? Are there any plugins that could accomplish this?

  • What do you mean by "reader service"? Do you mean RSS feed? Would this work?: premium.wpmudev.org/project/pay-per-view – David Kryzaniak Jul 19 '13 at 19:19
  • Not quite, more along the lines of interactive courses / guides where at the end, a reward would be available via the link (why having the page invisible to everyone else is important) – Scott Jul 19 '13 at 19:44
  • Are the users taking the course authenticated? Hmm, you could add a flag (AKA user_meta codex.wordpress.org/Function_Reference/add_user_meta) to their account, and then add some logic to the template to restrict views. This option is a little more secure than just basing access on the URL. Not sure this answer helps much. – David Kryzaniak Jul 19 '13 at 21:00

Only way to base access on url users come from is to rely on $_SERVER['HTTP_REFERER'], but as official php docs says:

Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

One chance is to use a secret key and pass it as variable in the url, then in the template check it against a custom field, something like:

if ( $_GET['secretkey'] == get_post_meta(get_the_ID(), 'secretkey', true) ) {
   // show the post
} else {
   echo 'Nothing for you here.';

but everyone knows the key (and add it to the url) will see the post (wherever comes from), so is not really secure.

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.