W3cubDocs

/WordPress

wp_is_post_revision( int|WP_Post $post )

Determines if the specified post is a revision.

Description

Parameters

$post

(int|WP_Post) (Required) Post ID or post object.

Return

(false|int) False if not a revision, ID of revision's parent otherwise.

Source

File: wp-includes/revision.php

function wp_is_post_revision( $post ) {
	if ( ! $post = wp_get_post_revision( $post ) ) {
		return false;
	}

	return (int) $post->post_parent;
}

Changelog

Version Description
2.6.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_is_post_revision