Redirect URL to Post

Redirect URL to Post, Version 0.18.0: Time Lock for Redirects

This release enables you to redirect to a random or other WordPress post while keeping the same target for a pre-set time.

This version of the Redirect URL to Post WordPress plugin adds two new URL parameters: a “time lock” and an option for the scope of cookies.

Stay a while with one post

The parameter lock lets you “lock”((Of course, it is possible to go to another post. We mean that the redirect_to link will redirect to the same post.)) a visitor to one post for a specified time. This way you can make sure that each visitor keeps seeing the same post until the time has expired. Use the parameter with a number in seconds.

Example:

www.example.com/?redirect_to=random&lock=86400

This feature works only in the same browser and if the visitor accepts and keeps cookies.

Possible applications:

  • Show a random post of the day.
  • Offer random posts through a link or button but make sure visitors can reload a post through the same link or button.

Please note that we still need to query the list of posts and check if the locked post is among them. If you want to reduce the database load, use the parameter cache.

Site-global cookies

Cookies (for each_once and lock) have now by default a domain-wide validity. That means that the posts a visitor has seen and the above-mentioned lock deliver the same result no matter which page the visitor is on.

You can switch to separate cookies per directory with the parameter directory_cookie (no value required). That is particularly useful if you use lock when redirecting to the previous or next post.

The complete changelog is available here.

Photo by Christoph Amthor

Christoph