Share

Allows you to redirect a certain page or post on your WordPress blog to another location, depending on the date.

You set the start and end dates, The post_id of the page you want redirecting and the URL where you want redirecting to..

The Code

Set Up

  • First you need to find the post_id of the page you want to redirect. If you edit that page, you will see post=xxxx in the address bar of your browser. That is your post_id! Change ‘135’ in the code to your own post_id.
  • Now set the start and end dates. Note that these dates are non-inclusive so in my example the redirect is active from Mar 22 – Jun 24 (inclusive).
  • Set $newlocation to the URL you want to be redirected to (both slashes are important!)

Share