On this page
_wp_get_post_revision_version( WP_Post $revision ): int|false
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.
Gets the post revision version.
Parameters
$revisionWP_Post Required
Return
int|false
Source
File: wp-includes/revision.php. View all references
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;
}
Related
Used By
| Used By | Description |
|---|---|
| edit_post() wp-admin/includes/post.php | Updates an existing post with values provided in |
| _wp_upgrade_revisions_of_post() wp-includes/revision.php | Upgrades the revisions author, adds the current post as a revision and sets the revisions version to 1. |
Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_get_post_revision_version