wp_save_post_revision_on_insert( int $post_id, WP_Post $post, bool $update )

In this article

Saves revisions for a post after all changes have been made.

Parameters

$post_idintrequired
The post id that was inserted.
$postWP_Postrequired
The post object that was inserted.
$updateboolrequired
Whether this insert is updating an existing post.

Source

function wp_save_post_revision_on_insert( $post_id, $post, $update ) {
	if ( ! $update ) {
		return;
	}

	if ( ! has_action( 'post_updated', 'wp_save_post_revision' ) ) {
		return;
	}

	wp_save_post_revision( $post_id );
}

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

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