WC_Post_Data::invalidate_db_block_templates_cache
Invalidates cache entries related to fetching block templates from DB. Please reference to Utils\BlockTemplateUtils::get_block_templates_from_db for further details.
Метод класса: WC_Post_Data{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$result = WC_Post_Data::invalidate_db_block_templates_cache( $post_id, $post ): void;
- $post_id(int) (обязательный)
- Post ID.
- $post(WP_Post) (обязательный)
- Post object.
Список изменений
| С версии 10.7.0 | Введена. |
Код WC_Post_Data::invalidate_db_block_templates_cache() WC Post Data::invalidate db block templates cache WC 11.2.2
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' );
}
}