WC_Post_Data::invalidate_db_block_templates_cachepublic staticWC 10.7.0

Invalidates cache entries related to fetching block templates from DB. Please reference to Utils\BlockTemplateUtils::get_block_templates_from_db for further details.

Method of the class: WC_Post_Data{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WC_Post_Data::invalidate_db_block_templates_cache( $post_id, $post ): void;
$post_id(int) (required)
Post ID.
$post(WP_Post) (required)
Post object.

Changelog

Since 10.7.0 Introduced.

WC_Post_Data::invalidate_db_block_templates_cache() code WC 10.8.1

public static function invalidate_db_block_templates_cache( $post_id, $post ): void {
	if ( $post instanceof \WP_Post && in_array( $post->post_type, array( 'wp_template_part', 'wp_template' ), true ) ) {
		wp_cache_delete( $post->post_type . '-ids', 'woocommerce_blocks' );
	}
}