get_the_modified_date

Advertisement

Summery Summery

Retrieve the date on which the post was last modified.

Syntax Syntax

get_the_modified_date( string $format = '', int|WP_Post $post = null )

Parameters Parameters

$format

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

Default value: ''

$post

(Optional) Post ID or WP_Post object. Default current post.

Default value: null

Return Return

(string|false) Date the current post was modified. False on failure.

Source Source

File: wp-includes/general-template.php

 * Date string output can be filtered with 'get_the_date'.
 *
 * @since 0.71
 *
 * @global string $currentday  The day of the current post in the loop.
 * @global string $previousday The day of the previous post in the loop.
 *
 * @param string $format Optional. PHP date format defaults to the date_format option if not specified.
 * @param string $before Optional. Output before the date.
 * @param string $after  Optional. Output after the date.
 * @param bool   $echo   Optional. Whether to echo the date or return it. Default true.
 * @return string|void String if retrieving.
 */
function the_date( $format = '', $before = '', $after = '', $echo = true ) {
	global $currentday, $previousday;

	$the_date = '';

	if ( is_new_day() ) {
		$the_date    = $before . get_the_date( $format ) . $after;
		$previousday = $currentday;
	}

	/**
	 * Filters the date a post was published for display.

Advertisement

Changelog Changelog

Changelog
Version Description
4.6.0 Added the $post parameter.
2.1.0 Introduced.

Advertisement

Leave a Reply