the_modified_date( string $d = '', string $before = '', string $after = '', bool $echo = true )

Display the date on which the post was last modified.


Description Description


Parameters Parameters

$d

(string) (Optional) PHP date format defaults to the date_format option if not specified.

Default value: ''

$before

(string) (Optional) Output before the date.

Default value: ''

$after

(string) (Optional) Output after the date.

Default value: ''

$echo

(bool) (Optional) default is display. Whether to echo the date or return it.

Default value: true


Top ↑

Return Return

(string|void) String if retrieving.


Top ↑

Source Source

File: wp-includes/general-template.php

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

	/**
	 * Filters the date a post was last modified for display.
	 *
	 * @since 2.1.0
	 *
	 * @param string $the_modified_date The last modified date.
	 * @param string $d                 PHP date format. Defaults to 'date_format' option
	 *                                  if not specified.
	 * @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, $d, $before, $after );

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

}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 4 content
    Contributed by Codex

    Date with superscript or subscript number suffixes
    Displays the date with a superscript or subscript st, nd, rd or th after the day. Because characters from the alphabet are used to represent the date format types, each of the HTML tag characters need to be escaped using a back slash. Superscript HTML tag is <sup> and subscript is <sub>.

    <p><?php printf( __( 'Modified: %s', 'textdomain' ), get_the_modified_date('j\<\s\u\p\>S\<\/\s\u\p\> M Y') ); ?></p>
    

    Modified: 2nd Dec 2006

You must log in before being able to contribute a note or feedback.