wc_load_webhooks()
Load webhooks.
No Hooks.
Return
true|false
.
Usage
wc_load_webhooks( $status, $limit );
- $status(string)
- Optional - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.5.0.
Default: '' - $limit(null|int)
- Limit number of webhooks loaded. @since 3.6.0.
Default: null
Changelog
Since 3.3.0 | Introduced. |
wc_load_webhooks() wc load webhooks code WC 9.4.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; }