wp_is_post_revision

The timeline below displays how wordpress function wp_is_post_revision has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.4

/**
 * Determines if the specified post is a revision.
 *
 * @since 2.6.0
 *
 * @param int|WP_Post $post Post ID or post object.
 * @return int|false ID of revision's parent on success, false if not a revision.
 */
function wp_is_post_revision($post)
{
    $post = wp_get_post_revision($post);
    if (!$post) {
        return false;
    }
    return (int) $post->post_parent;
}

WordPress Version: 5.3

/**
 * Determines if the specified post is a revision.
 *
 * @since 2.6.0
 *
 * @param int|WP_Post $post Post ID or post object.
 * @return false|int False if not a revision, ID of revision's parent otherwise.
 */
function wp_is_post_revision($post)
{
    $post = wp_get_post_revision($post);
    if (!$post) {
        return false;
    }
    return (int) $post->post_parent;
}

WordPress Version: 4.3

/**
 * Determines if the specified post is a revision.
 *
 * @since 2.6.0
 *
 * @param int|WP_Post $post Post ID or post object.
 * @return false|int False if not a revision, ID of revision's parent otherwise.
 */
function wp_is_post_revision($post)
{
    if (!$post = wp_get_post_revision($post)) {
        return false;
    }
    return (int) $post->post_parent;
}

WordPress Version: 3.7

/**
 * Determines if the specified post is a revision.
 *
 * @since 2.6.0
 *
 * @param int|object $post Post ID or post object.
 * @return bool|int False if not a revision, ID of revision's parent otherwise.
 */
function wp_is_post_revision($post)
{
    if (!$post = wp_get_post_revision($post)) {
        return false;
    }
    return (int) $post->post_parent;
}