Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_wp_get_post_revision_version() WordPress Function

The wp_get_post_revision_version() function is used to retrieve the version information for a given post revision. This function is useful for programmatically determining the current version of a post, or for determining the most recent post revision.

_wp_get_post_revision_version( WP_Post $revision ) #

Gets the post revision version.


Parameters

$revision

(WP_Post)(Required)


Top ↑

Return

(int|false)


Top ↑

Source

File: wp-includes/revision.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
3.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.