ACF\Pro\Datastore

REST_Save::cleanup_acf_transport_metapublicACF 6.8.1

Cleans up the transport-only _acf meta after the revision system finishes.

Hooked to wp_after_insert_post at priority 20, which runs after wp_save_post_revision_on_insert (priority 9). This catches orphaned _acf when no revision is created (e.g., post type doesn't support revisions). When a revision IS created, save_revision_meta() already deleted _acf, so this is a harmless no-op.

Method of the class: REST_Save{}

No Hooks.

Returns

null. Nothing (null).

Usage

$REST_Save = new REST_Save();
$REST_Save->cleanup_acf_transport_meta( $post_id );
$post_id(int) (required)
The post ID.

Changelog

Since 6.8.1 Introduced.

REST_Save::cleanup_acf_transport_meta() code ACF 6.8.8

public function cleanup_acf_transport_meta( $post_id ) {
	if ( $this->pending_cleanup_post_id === null || (int) $this->pending_cleanup_post_id !== (int) $post_id ) {
		return;
	}

	delete_post_meta( $post_id, '_acf' );
	$this->current_acf_values      = null;
	$this->pending_cleanup_post_id = null;
}