wc_load_webhooks()
Load webhooks.
Хуков нет.
Возвращает
true|false.
Использование
wc_load_webhooks( $status, $limit );
- $status(строка)
- Optional - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.5.0.
По умолчанию:'' - $limit(null|int)
- Limit number of webhooks loaded. @since 3.6.0.
По умолчанию:null
Список изменений
| С версии 3.3.0 | Введена. |
Код wc_load_webhooks() wc load webhooks WC 10.6.2
function wc_load_webhooks( $status = '', $limit = null ) {
// short-circuit if webhooks should not be loaded at all.
if ( ! is_null( $limit ) && $limit <= 0 ) {
return false;
}
$data_store = WC_Data_Store::load( 'webhook' );
$webhooks = $data_store->get_webhooks_ids( $status );
$loaded = 0;
foreach ( $webhooks as $webhook_id ) {
if ( ! is_null( $limit ) && $loaded >= $limit ) {
break;
}
$webhook = new WC_Webhook( $webhook_id );
$webhook->enqueue();
$loaded ++;
}
return 0 < $loaded;
}