acf_flush_field_cache()ACF 5.7.10

acf_flush_field_cache

Deletes all caches for this field.

No Hooks.

Returns

null. Nothing (null).

Usage

acf_flush_field_cache( $field );
$field(array) (required)
The field array.

Changelog

Since 5.7.10 Introduced.

acf_flush_field_cache() code ACF 6.8.8

function acf_flush_field_cache( $field ) {

	// Delete stored data.
	acf_get_store( 'fields' )->remove( $field['key'] );

	// Flush cached post_id for this field's name and key.
	wp_cache_delete( acf_cache_key( "acf_get_field_post:name:{$field['name']}" ), 'acf' );
	wp_cache_delete( acf_cache_key( "acf_get_field_post:key:{$field['key']}" ), 'acf' );

	// Flush cached array of post_ids for this field's parent.
	wp_cache_delete( acf_cache_key( "acf_get_field_posts:{$field['parent']}" ), 'acf' );
}