Last Modified Timestamp

Plugin Banner

Last Modified Timestamp

by Evan Mattson

Download
Description

This plugin adds information to the admin interface about when each post/page was last modified (including custom post types!).

Enhanced areas:

  1. Page/post admin tables – added Last Modified column which is also sortable.
  2. Page/post edit screen (post.php) – added Last modified on: *timestamp* to Publish meta box.
  3. Admin messages after editing a page/post – ie: Post updated. *timestamp* View Post,

No options currently available, but the output can be fully customized with filters and the shortcode can be easily customized using attributes!

Gutenberg, WordPress 5, and Beyond

This plugin does not yet enhance the new editor provided by Gutenberg and introduced as the default editor in WordPress 5.0. No plans exist to add support for this although it may be added in the future.
Other areas of wp-admin enhanced by the plugin still work, as does the classic editor.

  1. Upload the last-modified-timestamp folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  1. Page/post admin tables - added <code>Last Modified</code> column.

    Page/post admin tables - added Last Modified column.

  2. Page/post edit screen (<code>post.php</code>) - added <code>Last modified on: *timestamp*</code> to <code>Publish</code> meta box.

    Page/post edit screen (post.php) - added Last modified on: *timestamp* to Publish meta box.

  3. Admin messages after editing a page/post - ie: <code>Post updated. *timestamp* View Post</code>

    Admin messages after editing a page/post - ie: Post updated. *timestamp* View Post

How to add the last modified time to my page or post?

This plugin does not change the public facing appearance of your website, but gives you a few ways to add this if you wish.

  1. Using the [last-modified] shortcode. See below.
  2. Using template functions in your theme or plugin. See below.

How to provide the last modified time to search engines?

The best way to provide the last modified timestamp to search engines is by using a plugin to add an XML sitemap for your website. This is a special kind of document which provides various information to search engines about all the content on your website, including when each was last modified. Many SEO plugins provide include this functionality with them, but there are many standalone plugins for this as well. This allows search engines to reference a single file (which is automatically kept up to date for you by the plugin) to know exactly what content has changed on your whole website since it was last indexed, rather than recrawling every page.

This plugin may be used to display the last modified date and time to a reader on your website, but it is not intended as a tool for SEO.

How to use the [last-modified] shortcode?

[last-modified] Returns the last modified timestamp in this format date seperator time.

Attributes (all optional)

datef – specify a date format using the PHP date format.

timef – specify a time format using the PHP date format.

sep – specify the character/text you want to use to separate the date & time.

format – define the output format using placeholders %date%, %time%, and %sep%. Other text can be used as well.

How to change the outputted date/time format?

By default, the plugin mimicks the time & date formats used in the same context (ie: admin tables, publish box) that WordPress uses.

As mentioned above, LMT uses PHP date format strings for the formatting of the outputted date & time.

To customize the output with a shortcode, use the attributes as described above.

To customize the output in an admin context, a filter may be used.

  • last_modified_timestamp_defaults – allows default values to be filtered. Shortcode attributes override defaults when present, otherwise there are defaults for shortcode output as well. Passes 1 parameter (array).

For example, if you wanted to change the time format in the admin messages that appear after a post is modified to a 24hr format with leading zeros, add this to your theme’s functions.php:

function my_lmt_defaults( $d ) {

    $d['contexts']['messages']['timef'] = 'H:i';

    return $d;
}
add_filter('last_modified_timestamp_defaults','my_lmt_defaults');

Template Tags

Models the function naming convention used by WordPress for get_the_content / the_content and similar functions.

  • get_the_last_modified_timestamp() – returns timestamp.
  • the_last_modified_timestamp() – displays/echos the timestamp.

These functions accept 2 arguments, both are optional:

  • $context (string) to output formatted according to a defined context (ie: admin messages, posts table, etc.)
  • $override (array) using this will override any defaults that are specified here, but output can still be overriden at final output.
    Example array structure is: array('datef' => 'M j, Y', 'timef' => 'g:i', 'sep' => '&rarr;', 'format' => '%date% %sep% %time%')

Works well!

By brochite on November 3, 2022

This plugin works well, despite my confusion with a conflicting plugin that did give some issues. Kudos to the plugin writer Evan for writing back to help me solve an issue that wasn't his to solve!

I use it ever day!

By bobsled on July 27, 2022

I've used this plugin for years now. It works like a charm and does exactly what it says on the box.

Useful, simple plugin!

By ip-rob on July 8, 2020

Great way to track modification dates of posts on my blog on the admin side while giving the option of putting it on a post. I like that you can control if the modified date shows up by inserting the shortcode but it doesn't do it automatically. Some posts I don't want the modified date to be inserted if I'm fixing a typo or something similar. Great plugin!

Should be a standard feature

By thingevery on April 3, 2019

I added a privacy policy page to a client's website and wanted to automatically display when it was last updated. I was surprised to find this feature lacking from WP. Searched and found this super simple plugin, and it worked great. Thanks!

Simple & Effective

By amreshkramar on September 5, 2018

An effective plugin for lasting bloggers.

Essential for any blog

By (mitchellk) on August 18, 2018

I have a blog now 17 years old, THIS has proven to be the single most valuable plugin for me. Works like a charm.

Does exactly what it says

By J Werk (jwerk13040) on May 21, 2018

Good plugin. This should be part of WordPress core.

Works (almost) as intended

By kmorgen on April 30, 2018

Works overall as intended, but would be nice if plugin by default could use the date format already defined in the WP settings. Would then appear correct in Admin, and also no need having to alter this for each shortcode used.

Great plugin!

By LinkAssist on March 26, 2018

I'm looking forward to upcoming versions of this plugin. It's really simple to use - just install & activate, then go to the post or page listings in the admin area. Voila! A new sortable column, showing the date of the last update. Makes keeping the site up to date much easier!

Perfect solution to a glaring need in WP

By Sitestaging Dev (localprosper) on November 18, 2017

Works great in 4.9. Thank you, I donated!

1.0.6

  • Fix notice about loading translations too early
  • Bump minimum required version of WP to 4.6

1.0.5

  • Tweaked hook for testing
  • Integrated GitHub Actions

1.0.4

  • Add automated tests

1.0.3

  • Template function bugfix

1.0.2

  • Min required WP bump to >= 3.2
  • PHP compatibility fix

1.0.1

  • General housekeeping & maintanence
  • Tested against 3.8

1.0

Major Update

  • Added support for all custom post types.
  • Added [last-modified] shortcode.
  • Added filters to provide complete control.
  • Added template tags.
  • Encapsulated code.

0.4

  • Added support for other types of update messages.
  • Added filter to allow output to be customized.

0.3.1

  • Fixed sortable column on pages table.

0.3

  • The Last Modified column in the admin post/page tables is now sortable!
  • CSS – widened Last Modified column to account for extra width needed for sortable arrow.
  • Updated screenshot of Last Modified column in the admin post/page tables.
  • Corrected a typo in the admin messages for pages.

0.2

  • Fixed date formatting in the admin tables.

0.1

  • Initial release
Back to top