Automattic\WooCommerce\Blocks\Patterns
PTKPatternsStore::flush_cached_patterns
Reset the cached patterns to fetch them again from the PTK.
Метод класса: PTKPatternsStore{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$PTKPatternsStore = new PTKPatternsStore(); $PTKPatternsStore->flush_cached_patterns();
Список изменений
| С версии 10.4.1 | Введена. |
| С версии 10.4.1 | Unscheduling is deferred if Action Scheduler hasn't initialized yet. |
Код PTKPatternsStore::flush_cached_patterns() PTKPatternsStore::flush cached patterns WC 10.5.2
public function flush_cached_patterns() {
delete_option( self::OPTION_NAME );
if ( ! function_exists( 'as_unschedule_all_actions' ) ) {
return;
}
// Unschedule any existing fetch_patterns actions.
// Defer unscheduling until Action Scheduler is ready to avoid errors during early initialization.
if ( did_action( 'action_scheduler_init' ) ) {
as_unschedule_all_actions( self::FETCH_PATTERNS_ACTION, array(), 'woocommerce' );
} else {
add_action(
'action_scheduler_init',
function () {
as_unschedule_all_actions( self::FETCH_PATTERNS_ACTION, array(), 'woocommerce' );
}
);
}
}