Building Your Website, Step-By-Step

RYO ‘Oldest to Newest’ WordPress Plugin

A WordPress webmaster wanted a routine that would periodically take the oldest post and make it the newest post, showing up at the top of the home page. This would rotate articles through the system, recycling old material.

This was similar to something I was thinking of doing, so I did this one along the way.

See all of our WordPress Plugins

This routine checks to see if an article has been posted in the last n number of days, and if not, it locates the oldest post and changes the timestamp to the current day and time.

The interval is initially set at 7 days (one week); this means that every week if a new post has not been made in the last 7 days, an old post will be rotated to the top of the list and stamped with the current time and day. The plugin will also ping your standard ping list.

The interval may be changed to any number of days that you prefer by editing the days variable in the admin panel. By setting this large enough, it could be a day, a number of days, or weeks, even a month. (A week would be 7 days, a couple of weeks, 14 days, etc.) Or it could be as short as one day. It's up to you.

A rotation will not occur unless a page is loaded from your WordPress blog. So if you're extremely low on traffic, the rotation will be delayed until you have a visitor.

You might not want to use this if the timestamp is a critical component of your website, as the routine will change the timestamp with each move.

And if any of your posts are time sensitive, that is, if they mention news events, sporting events, etc., it would be a bad idea to use this.


  • Checks to see if an article has been posted in the prior period; if not, the oldest post is made fresh with a new timestamp.

  • The method allows you to post new articles and they maintain new status. Old posts are made new only if there's nothing new already.

  • The default period is 7 days, one week. This may be adjusted depending on your requirements.

  • If the old post is over six months old, the pinging mechanism will be engaged, just as if you'd manually changed the timestamp and republished the post.


  1. Add the plugin as you normally would with the WordPress plugin uploader, and activate it.
  2. Change the number of days in the admin panel, if you want something other than 7.


Version 2.0.0: Download

Change Log

Version 1.0: Initial release for WP 2.0.5.

Version 1.1: Changed to rotate an old post only if nothing new has been posted. Added ping routine for old posts older than six months. Changed default period to 7 days.

Version 1.2: Changed to update post modified date to match post date, query posts only, clear WP cache, reduce database queries.

Version 1.2.1: Added automatic update capability.

Version 2.0: Added admin panel to make it easy to change the number of days between processing. Changed the system to use the WordPress scheduler.

17 Responses to RYO ‘Oldest to Newest’ WordPress Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

Member Center



Your Own Dot-Com Domain
Our Recommended Source for Securing Your Domains. Fast Registration, Direct Support Phone

Reliable Website Hosting
Small businesses often use Shared Hosting and the "GrowBig" plan. Free LetsEncrypt SSL included.

Create Your Own Graphics
Website headers and banners are easy to do yourself when you have this inexpensive tool!