WordPress at Your Fingertips
function is not described

WC_Webhook_Data_Store::get_webhook_count() protected WC 3.6.0

Count webhooks.

{} It's a method of the class: WC_Webhook_Data_Store{}

No Hooks.

Return

Int.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_webhook_count( $status );
$status(string)
Status to count.
Default: 'active'

Changelog

Since 3.6.0 Introduced.

Code of WC_Webhook_Data_Store::get_webhook_count() WC 5.7.1

protected function get_webhook_count( $status = 'active' ) {
	global $wpdb;
	$cache_key = WC_Cache_Helper::get_cache_prefix( 'webhooks' ) . $status . '_count';
	$count     = wp_cache_get( $cache_key, 'webhooks' );

	if ( false === $count ) {
		$count = absint( $wpdb->get_var( $wpdb->prepare( "SELECT count( webhook_id ) FROM {$wpdb->prefix}wc_webhooks WHERE `status` = %s;", $status ) ) );

		wp_cache_add( $cache_key, $count, 'webhooks' );
	}

	return $count;
}