_wp_get_post_revision_version()WP 3.6.0

Gets the post revision version.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

Int|false.

Usage

_wp_get_post_revision_version( $revision );
$revision(WP_Post) (required)
-

Changelog

Since 3.6.0 Introduced.

_wp_get_post_revision_version() code WP 6.6.2

function _wp_get_post_revision_version( $revision ) {
	if ( is_object( $revision ) ) {
		$revision = get_object_vars( $revision );
	} elseif ( ! is_array( $revision ) ) {
		return false;
	}

	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) {
		return (int) $matches[1];
	}

	return 0;
}