Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Expire Posts or Partial Post Content in WordPress

Last updated on by
Elegant Themes
How to Expire Posts or Partial Post Content in WordPress

There are always times when you are running a time sensitive deal on your site that you want to expire. Often those posts live in a category like News or Contests, but there are times when you don’t want that. What if there was a way to get rid of the post entirely? What about just getting rid of part of the post content? Well in this article, we will share two plugins that can let you expire posts or partial post content in WordPress.

How to Expire Posts in WordPress?

There are ways to customize the loop with PHP codes and utilize custom fields to make this happen. But that sounds way too complicated. So we will be using a plugin called Post Expirator.

First thing you need to do is install and activate it. Then when you open your posts write panel, you will see a field like this:

Post Expirator - WordPress Plugin

You can enable the post expiration in there and select the date and time.

You are probably wondering what happens to the post once it is expired. You have two options, you can either change the status from Published to Draft or completely delete them. This option can be selected from the additional settings page that can be found under Settings » Post Expirator

Post Expirator Settings - WordPress Plugin

In the options page, you also have the ability to show when the post will expire to your users. Currently this plugin only supports the content type “posts” and “page”.

How to Expire Partial Post Content in WordPress

The above method shows how to expire the entire post, but in some cases that is not what you want. You probably just want to remove some part of the post after a certain time. Well in that case, the plugin called CF Expiring Content Shortcode is your best solution.

Download and Install the plugin. Once you have done that, there are no additional settings. Simply wrap your content in the shortcode and set the date/time you’d like it to expire – once that time is eclipsed, it will no longer appear.

The date format is anything that can be parsed by PHP’s strtotime function. A few examples:

  • [expires on="2010-10-01"]Expires on October 1, 2010[/expires]
  • [expires on="Jan 3, 2011"]Expires on January 11, 2011[/expires]
  • [expires on="12/3/2012 23:16:00"]Expires on December 2, 2012 at 11:16pm[/expires]
  • [expires on="2015-01-01 + 15 days"]Expires on January 16, 2015[/expires]

Any of these methods would work. Just wrap your content around this shortcode.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Melissa M. Miller says:

    That plugin (CF Expiring Content Shortcode) is outdated. Outdated plugins put your WordPress site at risk. Try Scheduled Content (by Sizeable),

    As for post expirator, I’ve been using it for quite some time and it’s amazing!!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.