WC_Webhook_Data_Store::get_webhooks_ids()publicWC 3.3.0

Get webhooks IDs from the database.

Method of the class: WC_Webhook_Data_Store{}

No Hooks.

Return

Int[].

Usage

$WC_Webhook_Data_Store = new WC_Webhook_Data_Store();
$WC_Webhook_Data_Store->get_webhooks_ids( $status );
$status(string)
Optional - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.6.0.
Default: ''

Changelog

Since 3.3.0 Introduced.

WC_Webhook_Data_Store::get_webhooks_ids() code WC 8.7.0

public function get_webhooks_ids( $status = '' ) {
	if ( ! empty( $status ) ) {
		$this->validate_status( $status );
	}

	$ids = get_transient( $this->get_transient_key( $status ) );

	if ( false === $ids ) {
		$ids = $this->search_webhooks(
			array(
				'limit'  => -1,
				'status' => $status,
			)
		);
		$ids = array_map( 'absint', $ids );
		set_transient( $this->get_transient_key( $status ), $ids );
	}

	return $ids;
}