_wp_get_post_revision_version()
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.
Returns
Int|false.
Usage
_wp_get_post_revision_version( $revision );
- $revision(WP_Post) (required)
- .
Changelog
| Since 3.6.0 | Introduced. |
_wp_get_post_revision_version() wp get post revision version code WP 6.9.1
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;
}