WordPress the_modified_time() Function

Beginner
6 min read
Updated: Nov 2026
3 examples
Prints the modified time

Definition

In WordPress, the_modified_time() prints the time of day when a post was last edited. For example, 9:45 am.

Pair it with the_modified_date() to show both the date and the time of the last change.

Syntax

A few ways to call the_modified_time().

WordPress
<p>Edited at <?php the_modified_time(); ?></p>
CallWhat it does
the_modified_time()Print the time in the site format.
the_modified_time( 'g:i a' )Print the time in your own format.
the_modified_time( 'F j, Y' )You can also print a date with it.
get_the_modified_time()Return the time as a string.

It prints the modified time. The default format comes from Settings > General.

Full declaration
WordPress
the_modified_time( string $format = '' ): void

Parameters

ParameterDescription
$formatstring. A PHP date format. Default is the site time format.

Return Value

Return ValueDescription
voidNothing is returned. The time is printed.

WordPress Examples

Three short examples. Each one shows the code and what it prints.

Example 1 — Print the time

Print the time with the default format.

WordPress
<p>Edited at <?php the_modified_time(); ?></p>

How It Works

  1. the_modified_time() prints the time of the last edit.
  2. The default format is the one set in Settings > General.
  3. The sentence around it is ours.

Example 2 — Use a 24 hour format

Pass a PHP format to change how the time looks.

WordPress
<p>Edited at <?php the_modified_time( 'H:i' ); ?></p>

How It Works

  1. H is the hour with 24 hour format.
  2. i is the minutes.
  3. You can change the look any time with a new format.

Example 3 — Date and time together

Use it with the modified date.

WordPress
<p>
  Updated on <?php the_modified_date( 'F j, Y' ); ?>
  at <?php the_modified_time( 'g:i a' ); ?>
</p>

How It Works

  1. the_modified_date() prints the date.
  2. the_modified_time() prints the time.
  3. Together they show exactly when the post changed.

Frequently Asked Questions

It prints the time of day when the post was last edited.
Pass a PHP date format as the first argument, for example g:i a.
Use get_the_modified_time().
Check the time zone in Settings > General.
Use the_modified_date().

Browse all post functions

Open the functions index for simple guides with examples and FAQs.

Post Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful