wp_post_revision_title( int|object $revision, bool $link = true )

Retrieve formatted date timestamp of a revision (linked to that revisions’s page).


Description Description


Parameters Parameters

$revision

(int|object) (Required) Revision ID or revision object.

$link

(bool) (Optional) Link to revisions's page?

Default value: true


Top ↑

Return Return

(string|false) i18n formatted datetimestamp or localized 'Current Revision'.


Top ↑

Source Source

File: wp-includes/post-template.php

function wp_post_revision_title( $revision, $link = true ) {
	if ( !$revision = get_post( $revision ) )
		return $revision;

	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
		return false;

	/* translators: revision date format, see https://secure.php.net/date */
	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
	/* translators: %s: revision date */
	$autosavef = __( '%s [Autosave]' );
	/* translators: %s: revision date */
	$currentf  = __( '%s [Current Revision]' );

	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
		$date = "<a href='$link'>$date</a>";

	if ( !wp_is_post_revision( $revision ) )
		$date = sprintf( $currentf, $date );
	elseif ( wp_is_post_autosave( $revision ) )
		$date = sprintf( $autosavef, $date );

	return $date;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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