check: https://codex.wordpress.org/Function_Reference/wp_update_post
Make sure not to create an infinite loop.
<?php
function my_function( $post_id ){
if ( ! wp_is_post_revision( $post_id ) ){
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'my_function');
// update the post, which calls save_post again
wp_update_post( $my_args );
// re-hook this function
add_action('save_post', 'my_function');
}
}
add_action('save_post', 'my_function');
?>
to stop revisions try to add: https://wordpress.stackexchange.com/a/3398
remove_action('pre_post_update', 'wp_save_post_revision');// stop revisions
and
add_action('pre_post_update', 'wp_save_post_revision');// enable revisions again
Good luck 😉