LukaCodes Content Expiry Shortcode

Description

We created LukaCodes Content Expiry Shortcode for cases where we want to publish content for a limited period and let it expire automatically without having to come back and edit the page later.

With the [lcexp] shortcode, we can wrap any temporary content inside a date-based rule. Until the selected date and time, the content is shown normally. Once that time passes, the plugin replaces it with a clear expiry message.

This makes the plugin useful for many everyday WordPress tasks, such as:

  • limited-time offers
  • temporary announcements
  • event notices
  • holiday messages
  • launch updates
  • short-term promotional text

Instead of removing content manually after a campaign or announcement ends, we can set the expiry date in advance and let the plugin handle it for us.

How we use it

We place the shortcode around the content we want to display temporarily:

[lcexp "30-06-2026 23:59"]This content will stay visible until the selected date and time.[/lcexp]

Before the selected date and time:
the content inside the shortcode is displayed normally.

After the selected date and time:
the content is replaced automatically with the message:

This content is no longer available.

Accepted date formats

We can use the shortcode with the following formats:

  • DD-MM-YYYY HH:MM
  • DD-MM-YYYY

We also support slash-separated dates such as:

  • DD/MM/YYYY HH:MM
  • DD/MM/YYYY

Examples

[lcexp "30-06-2026 23:59"]This offer ends tonight.[/lcexp]

[lcexp "25-12-2026"]Holiday message[/lcexp]

[lcexp "18:30 15-08-2026"]Event reminder[/lcexp]

What we wanted to keep simple

We designed this plugin to stay lightweight and practical. We did not want to add unnecessary setup screens for something that can be handled directly inside the editor with a shortcode.

Features

  • simple shortcode-based usage
  • automatic content expiry by date and time
  • works in posts and pages
  • works in WooCommerce product descriptions and short descriptions
  • supports nested shortcode content through normal shortcode rendering
  • uses the WordPress site timezone
  • lightweight and easy to use
  • multilingual-ready

Premium

We also offer a Premium version at:

https://lukacodes.com/plugins/content-expiry-shortcode/

In the Premium version, we expand the experience with additional tools such as a visual Gutenberg workflow and faster content insertion options.

Third-Party Service

This plugin integrates with Freemius for optional telemetry, upgrade handling, and the deactivation feedback form.

Freemius is only connected after the site owner explicitly opts in. If the opt-in is declined, no telemetry is sent.

Service provider: Freemius
Website: https://freemius.com
Terms of service: https://freemius.com/terms/
Privacy policy: https://freemius.com/privacy/

When a site owner opts in, Freemius may collect basic diagnostic and site data such as the website URL, WordPress version, plugin version, PHP version, language, and activation/deactivation events. If the site owner submits the deactivation form, the selected reason and optional feedback are also sent.

Screenshots

  • Using the [lcexp] shortcode inside the WordPress editor.
  • Example of content shown normally before the expiry date.
  • Example of the expiry message displayed after the selected date and time.

Installation

  1. Upload the lukacodes-content-expiry-shortcode folder to the /wp-content/plugins/ directory, or install the plugin through the WordPress Plugins screen.
  2. Activate the plugin through the Plugins screen in WordPress.
  3. Open any post or page where you want to show temporary content.
  4. Add the shortcode with your preferred expiry date and time.

Example:

[lcexp "30-06-2026 23:59"]Your content here[/lcexp]

FAQ

How does the shortcode work?

We place the content we want to show temporarily between the opening and closing shortcode tags.

Example:

[lcexp "30-06-2026 23:59"]This content will expire automatically.[/lcexp]

The date inside the shortcode tells the plugin when that content should stop being displayed.

What happens after the expiry date?

After the selected date and time passes, the plugin replaces the content with the message:

This content is no longer available.

What date format should we use?

We recommend using:

DD-MM-YYYY HH:MM

Example:

[lcexp "30-06-2026 23:59"]Temporary content[/lcexp]

We also support date-only format:

DD-MM-YYYY

and slash-separated dates such as:

DD/MM/YYYY HH:MM

Which timezone does the plugin use?

We use your WordPress site timezone.

You can check or change it from:

Settings > General > Timezone

Does it work in the Classic Editor and Gutenberg?

Yes. We can use the shortcode in both the Classic Editor and the Block Editor.

Can we use more than one shortcode on the same page?

Yes. We can use multiple [lcexp] shortcodes on the same page with different dates and different content.

Does the plugin hide the content completely?

After expiry, the original content is no longer shown. In its place, the plugin displays a clear expiry message so visitors do not see an empty gap.

Does it work with any WordPress theme?

Yes. We built it to work independently of the active theme.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“LukaCodes Content Expiry Shortcode” adalah perisian sumber terbuka. Orang-orang berikut telah menyumbang kepada pemalam ini.

Penyumbang

Changelog

1.1.1

  • Added Freemius integration for optional opt-in analytics and deactivation feedback.
  • Updated the Premium purchase link to the main plugin page.

1.1.0

  • Added WooCommerce integration: the [lcexp] shortcode now works inside product descriptions and short descriptions.
  • Added WooCommerce REST API support: shortcode content is correctly evaluated when product data is fetched via the REST API.

1.0.0

  • Initial release.
  • Added the [lcexp] shortcode for expiring temporary content by date and time.
  • Added support for DD-MM-YYYY HH:MM and DD-MM-YYYY formats.
  • Added multilingual-ready text strings.