How to Auto Expire Posts in WordPress
Posted onA blog can serve many functions. It doesn’t just have to be restricted to traditional posts. WordPress especially can be modified to work extremely well as an e-commerce store, a normal business website, or something less traditional such as a giveaway portal etc.. This means that sometimes the traditional definition of a “post” needs to be changed. Normally, all entries in a blog are eternal and don’t change their status depending on external factors. But what if you’re running a promotion that has a time-limited validity? You might want to recategorize it after it has expired or even delete the post altogether.
While you can of course do this manually, why not have a plug-in do it for you if it’s going to be on a regular basis? One of the best add-ons for WordPress that allows us to carry out this functionality is called Post Expirator. let’s take a look at how to use it and what customizations we can make.
Expiring Posts Automatically
After downloading and installing the plug-in, you can get started by creating a new post that you want to expire at a specified time in the future. On the right-hand side of the screen you should see a new section called “Post Expirator”. The exact location may vary and you might need to scroll down a bit to find it on the right. If you want, WordPress allows you to reposition the module so just drag-and-drop the title to where you want it to be.
This module allows you to activate and deactivate post expiration for individual entries. When the checkbox is clicked, the other options below it take effect.
Here you can specify the exact date and time of when you want the posts to expire. Keep in mind that this is a function of the server time so if your post is targeted towards a specific country, you may need to do some time conversion to ensure that the post expires as per their time zone.
Once you’ve selected the expiry time, you need to tell the plug-in what to do with the post once that happens. Here you have a number of choices ranging from simply deleting the post or changing the category. I personally find it more logical to create a category called “Expired” and relocate the post there instead. This is the option that I have selected in the screenshot above. Once you do that, you can configure WordPress to not display that category on the homepage if you want.
As you can see in the screenshot below, after publishing the post it displays normally as you would expect.
If you want, you can go into the plug-in settings and configure it so that the expiry date is displayed in the post footer so that everyone knows that the content is time-limited.
At any given point, you can get a bird’s eye view of which posts are scheduled to expire at what time by visiting the default list of posts in the WordPress dashboard. You should see a new column appear on the right providing you with this information.
Once the specified date and time has passed, the plug-in will carry out the configured action – in my case transferring the post to the Expired category.
All of these options can be set as the default in the plug-in settings so that you don’t have to manually configure it each and every time. In addition, you can also enable debugging in case you want to track the exact sequence of events that led to a particular action.
All in all, the “Post Expirator” plug-in is a great tool for time-limited content that you need to either hide or recategorize in WordPress.
I am just wondering is it possible to move the expired posts down the list of all posts on the blog page?