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
Follow WPBeginner on YouTube
How to Expire Posts or Partial Post Content in WordPress

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.

Expire Post Content

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.

Video Tutorial

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:

Post Expirator - WordPress Plugin

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.

Post Expirator Settings - WordPress Plugin

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.

Post Expirator Footer Settings - WordPress Plugin

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.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


Editorial Staff at WPBeginner is a team of WordPress experts 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. John Bowden says:

    Just replaced a plugin that no longer worked with Post Expirator. Working like a champ on my site. Thank you!

  2. george pal says:

    I have tested Post Expirator plugin on a multisite installation.
    The plugin DOES NOT work.
    As soon as it gets enabled there is a php message telling:

    Strict Standards: Declaration of Walker_PostExpirator_Category_Checklist::start_lvl() should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in /volume1/web/wp-content/plugins/post-expirator/post-expirator.php on line 0
    Strict Standards: Declaration of Walker_PostExpirator_Category_Checklist::end_lvl() should be compatible with Walker::end_lvl(&$output, $depth = 0, $args = Array) in /volume1/web/wp-content/plugins/post-expirator/post-expirator.php on line 0
    Strict Standards: Declaration of Walker_PostExpirator_Category_Checklist::start_el() should be compatible with Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 0) in /volume1/web/wp-content/plugins/post-expirator/post-expirator.php on line 0
    Strict Standards: Declaration of Walker_PostExpirator_Category_Checklist::end_el() should be compatible with Walker::end_el(&$output, $object, $depth = 0, $args = Array) in /volume1/web/wp-content/plugins/post-expirator/post-expirator.php on line 0

    Except from that, the metabox on wordpress backend admin breaks the responsive layout, see what I mean here: and here:

  3. Leslie Nicole says:

    Thank you! I’ve been reluctant to post “news” as you end up having your archives peppered with out-dated posts. This is plug-in should be really handy!

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.