Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author jamiechong

    (@jamiechong)

    Are you using a hook or filter?

    Thread Starter charafweb

    (@charafweb)

    Hi @jamiechong
    Thanks for your reply.
    I’m using this action from “WP All Import” plugin to check if the post will be updated during the import process. I’m trying to schedule imported (only updated) posts.

    function my_is_post_to_update( $continue_import, $post_id, $data, $import_id ) {
        ...
    
        $post = get_post($post_id);
        Revisionize\create_revision($post, true); // create a revision of the original post
    
        // Getting Revision ID
        $new_id= how_to_get_id_of_the_revision(); // << THIS
    
        $post = get_post($new_id); // Geting post object
    
        $post->post_date_gmt = $postdate_gmt; // defined earlier
        $post->post_date  = $postdate; // defined earlier
    	
        wp_update_post( $post ); // Update the revision with scheduled dates
    
        ...
    
    }
    add_filter( 'wp_all_import_is_post_to_update', 'my_is_post_to_update', 10, 4 );

    Thank you

    • This reply was modified 4 years, 9 months ago by charafweb.
    Plugin Author jamiechong

    (@jamiechong)

    I’m not to sure – would have to dig back into that core code (haven’t looked at it in a while). Inspect and see what happens in create_revision. Some post_meta fields get set that might be of use to you.

    Note that revisionize wasn’t designed to be manually called like this. You’ll have to inspect the open source code to figure out what you need. Best of luck!

    Thread Starter charafweb

    (@charafweb)

    I do know that your plugin was not designed to be used like that 🙂 I will look again in the core code, as you said, to try to understand what happening there 🙂 If you come back with any idea please share it with me.
    Thanks a ton

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to get ID of the revision’ is closed to new replies.