how to get last revision id created after wp_update_post

wordpress always store revision after call wp_update_post.
How to get the post revision ID after call wp_update_post?

Thanks

Related posts

1 comment

  1. You can use wp_get_post_revisions.

    <?php
    // some logic here
    
    $post_id = wp_update_post(/* ... */);
    $latest_revision = array_shift(wp_get_post_revisions($post_id));
    
    if ($latest_revision) {
       // do stuff with the latest revision
       // $latest_revision->ID will contain the latest revision
    }
    

Comments are closed.