wp_is_post_revision( int|WP_Post $post ): int|false

In this article

Determines if the specified post is a revision.

Parameters

$postint|WP_Postrequired
Post ID or post object.

Return

int|false ID of revision’s parent on success, false if not a revision.

Source

function wp_is_post_revision( $post ) {
	$post = wp_get_post_revision( $post );

	if ( ! $post ) {
		return false;
	}

	return (int) $post->post_parent;
}

Changelog

VersionDescription
2.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.