How to Display the Last Updated Date on Your Website Using a Shortcode

By Webmaster

Posted: 14m & 14d ago
1 min read

👁 Views: 222

(0) Leave a Comment

Shortcode - WpScriptly

To keep your content fresh and let your readers know when it was last revised, you can add a “Last Updated” date to your pages or posts. By using a simple shortcode, you can easily include this information anywhere on your website. Below is an example of how to implement this feature using a shortcode

I use fluent snippet plugin for all my functions, js, and CSS:


.time{
    font-weight:bold;
    color:#070537;
}

Place this coding inside code ssnippet plugin. I personally use Fluent snippet.

*This line will display Apr · 2024. you can change the 

( 'M · Y' )

to match your wordpress settings in the settings → General 

// Define the shortcode function
function current_date_shortcode() {
    // Get the current date
    $current_date = date_i18n( 'M · Y' );
    // Style for the displayed date
    // Return the current date with inline style
    return '<span class="time">' . $current_date . '</span>';
}
// Register the shortcode
add_shortcode( 'current_date', 'current_date_shortcode' );

The short code is

 [current_date]

I recomend placing this in a paragraph or a shortcode block.

Example: Last Updated: 

Posted: Aug · 2025

*WP Scriptly reserves the right to update any page content at any time without prior notice.

Live example is: https://wpscriptly.com/tos/ at the bottom.

Use as is

Author: Webmaster

Hey, I’m Scot, the guy behind WpScriptly. I create simple, no-fluff WordPress plugins and tools to make your site easier to manage and more powerful. Everything I build is tested on my own projects first — if it’s here, it’s because it works. Thanks for checking out the site. Hope you find something useful at Wp Scriptly.

Follow me at:

Add your first comment to this post