acf_get_post_latest_revision()ACF 5.3.8

acf_get_post_latest_revision

This function will return the latest revision for a given post

No Hooks.

Returns

$post_id. (int)

Usage

acf_get_post_latest_revision( $post_id );
$post_id(required)
.

Changelog

Since 5.3.8 Introduced.

acf_get_post_latest_revision() code ACF 6.0.4

function acf_get_post_latest_revision( $post_id ) {

	// vars
	$revisions = wp_get_post_revisions( $post_id );

	// shift off and return first revision (will return null if no revisions)
	$revision = array_shift( $revisions );

	// return
	return $revision;

}