Have you ever wished that you can set an expiration date for your blog posts? Perhaps you have timely content such as deals or giveaways that have been outdated which you want to automatically expire? In this article, we will show you how to expire posts and pages in WordPress. We will also show you how to schedule part of your post or page content to be expired after a specific date.
When would you want to expire posts or partial post content?
The primary use case of post expiration is to expire time-sensitive content such as special deals, coupons, giveaways, and event announcements.
In certain cases, you may want to keep the post active on your site because it is helpful, but only expire partial content such as a special limited-time discount coupon which no longer works..
First let’s take a look at how to expire posts, then we will look at how to expire partial post content.
If you don’t like the video or need more instructions, then continue reading.
How to Expire Posts in WordPress?
There are ways to customize the WordPress loop with PHP codes and utilize custom fields to make this happen, but that is too much work. Let’s take a look at an easier solution: Post Expirator plugin.
First thing you need to do is install and activate the plugin. Once activate, go to edit any WordPress post or page, and you will see a new metabox like this:
You can enable the post expiration and select the date / time that you want this post to expire on.
You are probably wondering what happens to the post once it is expired. Well, you get to decide that. There are several options to choose from.
You can either make it a draft (unpublish it), set it to private, delete the post altogether, or you can change the post category.
You also have additional settings that you can configure from the settings page found under Settings » Post Expirator.
You can choose the date and time format along with the default expiration category. You also have the option to add the post expiration date at the end of your content to let your users know when this post or page will be expiring.
Another plugin that offers similar functionality is called Simple Post Expiration.
How to Expire Partial Post Content in WordPress
The above method shows you how to expire the entire post or page, but in some cases that is not what you want. You may just want to remove part of the post or page content after a certain time. Well in that case, the plugin called Scheduled Content is your best solution.
This plugin allows you to schedule part of your post content to be published and expired based on the dates you specify.
First thing you need to do is install and activate the plugin. Once you have done that, there are no additional settings. All you need to do is wrap your content with the shortcode and set the date/time you’d like it to expire on. When that time arrives, this content will disappear and no longer be visible to your users.
[schedule on=’2014-12-01′ at=”10:01″ expon=’2014-12-01′ expat=”13:15″] the content you want to hide here [/schedule]
The date has to be set in yy-mm-dd format, and time has to be set in the 24 hours format.
The time is compared with your blog’s time zone settings, so make sure you have the right time zone by going to Settings » General.
You can also add shortcodes inside this schedule shortcode as well.
We hope this article helped you learn how to expire posts in WordPress and expire partial post and page content in WordPress.