A WordPress-centric search engine for devs and theme authors



_wp_get_post_revision_version ›

Since3.6.0
Deprecatedn/a
_wp_get_post_revision_version ( $revision )
Access:
  • private
Parameters:
  • (WP_Post) $revision
    Required: Yes
Returns:
  • (int|false)
Defined at:
Codex:

Gets the post revision version.



Source

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