WC_API_Webhooks::get_webhooks()publicWC 2.2

Get all webhooks

Метод класса: WC_API_Webhooks{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_API_Webhooks = new WC_API_Webhooks();
$WC_API_Webhooks->get_webhooks( $fields, $filter, $status, $page );
$fields(массив)
-
По умолчанию: null
$filter(массив)
-
По умолчанию: array()
$status(строка)
-
По умолчанию: null
$page(int)
-
По умолчанию: 1

Список изменений

С версии 2.2 Введена.

Код WC_API_Webhooks::get_webhooks() WC 8.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 );
}