TIEexpire Automated Post Expiry WordPress Plugin

TIEexpire is now a part of the free TIEtools plugin, available from the WordPress repository.

In the middle of 2013, I found that I needed a WordPress plugin for a variety of automated sites. I wanted something simple, that would expire posts so that I kept only the most recent.

getpluginbutton

Looking on the WordPress Plugin Repository, I found several options. Ignoring the premium ones, there were one or two that had the basics of what I needed… but they didn’t work, were unreliable, had weird implementations or were otherwise unwieldy.

So, as part of my ongoing self-education, I decided to write my own.

Writing a WordPress plugin is complicated. I used a variety of sources found on Google, posted half a dozen queries on WP and Stackoverflow (thank you to those who helped) and battled a minimal lack of php knowledge (and lots of annoying semi-colons) to put together something simple and effective.

Starting as a simple expiry plugin which would remove old posts based on publishing date or retain the latest n posts, the TIEexpire plugin has grown to include four different expiry methods (interfacing with two other plugins), category filters, post status options and email notifications.

TIEexpire Automated Post Expiry

You can download or install the plugin from the WordPress Plugin Repository. You can, of course, donate to the development fund:




The plugin is a work in progress. I suspect it always will be. I hope it’s useful. It is designed to provide a simple expiry method as outlined below:

  1. Expire published, draft, pending and/or private posts
  2. Include or exclude a list of categories
  3. Move all expired posts to the Trash
  4. Expire posts based on their age
  5. Retain a given number of posts and expire all others
  6. Detect the BAW Post Views Count plugin and expire posts based on a combination of post age and number of views
  7. Detect the WTI Like Post plugin and expire posts based on a combination of post age and total number of likes
  8. Send a notification email to the post author, site admin and other people on demand

The expiry functionality is cumulative: for example, if you have both detectable plugins installed and wish to expire all posts with fewer than 10 views after 10 days or no positive likes (total balance) after 14 days, retire everything older than 90 days and only retain a maximum of 1,500 posts, you can do it. Each test is taken in order and applied separately, so you can build complex retention mechanisms.

Version 1.0.3 added the ability to include or exclude a list of categories, so you can leave parts of your work untouched or just expire certain content areas. The filters are global but can be switched on or off for each expiry method.

Version 1.0.4 added the ability to include or exclude the standard post status settings (published, draft, pending, private) for even more control.

Version 1.1 added notification emails for the post author, site admin and user-defined “someone else”. Each recipient receives a separate email, the text of which can be edited in the plugin file.

The only known bug is that the plugin sometimes does not successfully set up a wp-cron job when activated (though deactivating and reactivating it sorts that out). I have no idea why this happens, since the code is fine.

More functionality may be added in the future. My plan is to completely restructure the expiry settings so that users can build their own criteria in their own order. Trouble is, I have to learn an awful lot more about php and WordPress to do that.

Developing the plugin

For visitors interested in learning about plugin development as a total noob (which I was when I started and probably still am) or understanding more about how the TIEexpire plugin works, the entire development process is catalogued on this site.

Start with the post “How to Build a WordPress Plugin” and follow each step in the development process.

Bugs and requests

These are all handled through the WordPress Plugin repository and the associated forums.

Leave a Reply