wordpress / latest / functions / the_modified_date.html

the_modified_date( string $format = '', string $before = '', string $after = '', bool $echo = true ): string|void

Displays the date on which the post was last modified.

Parameters

$format string Optional
PHP date format. Defaults to the 'date_format' option.

Default: ''

$before string Optional
Output before the date.

Default: ''

$after string Optional
Output after the date.

Default: ''

$echo bool Optional
Whether to echo the date or return it.

Default: true

Return

string|void String if retrieving.

More Information

This tag works just like the_modified_time() , which also displays the time/date a post was last modified. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Settings > General is used for the display format.

If the post or page is not yet modified, the modified date is the same as the creation date.

Use get_the_modified_date() to retrieve the value.

Source

File: wp-includes/general-template.php. View all references

function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {
	$the_modified_date = $before . get_the_modified_date( $format ) . $after;

	/**
	 * Filters the date a post was last modified for display.
	 *
	 * @since 2.1.0
	 *
	 * @param string|false $the_modified_date The last modified date or false if no post is found.
	 * @param string       $format            PHP date format.
	 * @param string       $before            HTML output before the date.
	 * @param string       $after             HTML output after the date.
	 */
	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );

	if ( $echo ) {
		echo $the_modified_date;
	} else {
		return $the_modified_date;
	}

}

Hooks

Uses

Uses Description

Changelog

Version Description
2.1.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/the_modified_date