Expiring Posts

plugin banner

It does this by adding a new "Expires" date field in the Publish box.

Author:Ivan (profile at wordpress.org)
WordPress version required:6.6
WordPress version tested:7.2
Plugin version:2.0.0
Added to WordPress repository:21-03-2019
Last updated:26-11-2026
Rating, %:70
Rated by:2
Plugin URI:https://github.com/ivankruchkoff/expiring-pos...
Total downloads:6 855
Active installs:300+
plugin download
Click to start download

Expiring Posts lets you set an expiry date on any post, page or custom post type. When the date arrives, the post moves to a new Expired status and is no longer visible to visitors. Nothing is deleted: expired posts stay in your admin under the Expired view, and you can publish them again at any time.

Use it for sales and promotions, job listings, event announcements, limited offers, or anything that should only be online for a while.

Features

  • Block editor: an Expires row in the post sidebar, next to Status and Date, with a date and time picker.
  • Classic editor: an Expires field in the Publish box, just like the publish date.
  • Expire now: expire a published post straight away, from either editor.
  • Expired status: expired posts are hidden from visitors, search and feeds, but editors can still open and preview them.
  • Easy to restore: publish an expired post again and it is back online. If its expiry date has passed, expiry is turned off so it doesn’t expire again straight away.
  • Post list: see at a glance which posts are expiring, and when.
  • Show the date on your site with the [expiring_posts_date] shortcode or the exp_the_expiration_date() template tag.
  • Uses your site’s timezone everywhere.
  • Works with custom post types.
  • Developer friendly: filters, actions, a PHP API and a REST API field.

How it works

When you set an expiry date, the plugin schedules a single WP-Cron event for the next post that is due. When it runs, every post whose date has passed moves to the Expired status, and the event is scheduled for the next one.

Only published, scheduled and private posts expire. Drafts and pending posts are left alone.

Only users who can publish a post can change its expiry.

Developer notes

Development happens on GitHub: https://github.com/ivankruchkoff/expiring-posts

  • The post status is expired.
  • Expiry is stored in post meta: exp_expiration_date (site timezone, Y-m-d H:i:s) and exp_pending_expiration (1 when expiry is on). Both keys are protected, so they don’t show in the Custom Fields box.
  • The expiring_posts REST API field (in the edit context) reads and writes { "enabled": true, "date": "2026-12-01T23:59:00" }. Dates are in the site timezone; dates with a UTC offset are converted.

Functions

  • exp_expire_post( $post, $timestamp = false ) sets a post to expire at a Unix timestamp. Without a timestamp the post expires immediately.
  • exp_unschedule_expiring_post( $post ) turns expiry off.
  • exp_get_expiration_timestamp( $post = null ) returns the expiry as a Unix timestamp, or false.
  • exp_get_expiration_date( $post = null, $format = '' ) returns the formatted expiry date.
  • exp_the_expiration_date( $format = '', $before = '', $after = '' ) prints it.

Shortcode

[expiring_posts_date format="F j, Y" none="Never expires"] shows the current post's expiry date. Both attributes are optional.

Filters

  • exp_disable_expiration_for_this_post ( bool $disabled, int $post_id ): return true to hide the controls and stop a post from expiring.
  • exp_supported_post_types ( string[] $post_types ): post types that can expire.
  • exp_expirable_post_statuses ( string[] $statuses ): statuses that can move to Expired. Default publish, private, future.
  • exp_user_can_manage_expiration ( bool $can, WP_Post $post ): who can change a post’s expiry.
  • exp_expired_post_status_args ( array $args ): arguments for register_post_status(). For example, set public to true to keep expired posts visible.
  • exp_expire_batch_size ( int $size ): posts expired per cron run. Default 100.
  • exp_get_expiring_posts ( array $posts ): the post ID => timestamp list used for scheduling.

Actions

  • exp_post_expired ( int $post_id, string $old_status ): after a post expires.
  • exp_expire_post ( int $post_id, int $timestamp ): after exp_expire_post() sets a date.
  • unschedule_expiring_post ( int $post_id ): after expiry is turned off.

Screenshots
FAQ
ChangeLog