wc_load_webhooks( string $status = '', null|int $limit = null )

Load webhooks.


Description Description


Parameters Parameters

$status

(Optional) - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.5.0.

Default value: ''

$limit

(Optional) Limit number of webhooks loaded. @since 3.6.0.

Default value: null


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/wc-webhook-functions.php

function wc_load_webhooks( $status = '', $limit = null ) {
	$data_store = WC_Data_Store::load( 'webhook' );
	$webhooks   = $data_store->get_webhooks_ids( $status );
	$loaded     = 0;

	foreach ( $webhooks as $webhook_id ) {
		$webhook = new WC_Webhook( $webhook_id );
		$webhook->enqueue();
		$loaded ++;

		if ( ! is_null( $limit ) && $loaded >= $limit ) {
			break;
		}
	}

	return 0 < $loaded;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.