WC_API_Webhooks::get_webhooks()publicWC 2.2

Get all webhooks

Method of the class: WC_API_Webhooks{}

No Hooks.

Return

Array.

Usage

$WC_API_Webhooks = new WC_API_Webhooks();
$WC_API_Webhooks->get_webhooks( $fields, $filter, $status, $page );
$fields(array)
-
Default: null
$filter(array)
-
Default: array()
$status(string)
-
Default: null
$page(int)
-
Default: 1

Changelog

Since 2.2 Introduced.

WC_API_Webhooks::get_webhooks() code WC 7.7.0

public function get_webhooks( $fields = null, $filter = array(), $status = null, $page = 1 ) {

	if ( ! empty( $status ) ) {
		$filter['status'] = $status;
	}

	$filter['page'] = $page;

	$query = $this->query_webhooks( $filter );

	$webhooks = array();

	foreach ( $query['results'] as $webhook_id ) {
		$webhooks[] = current( $this->get_webhook( $webhook_id, $fields ) );
	}

	$this->server->add_pagination_headers( $query['headers'] );

	return array( 'webhooks' => $webhooks );
}