WC_Webhook::should_deliver()privateWC 2.2.0

Helper to check if the webhook should be delivered, as some hooks. (like wp_trash_post) will fire for every post type, not just ours.

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

Хуки из метода

Возвращает

true|false. True if webhook should be delivered, false otherwise.

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

// private - только в коде основоного (родительского) класса
$result = $this->should_deliver( $arg );
$arg(разное) (обязательный)
First hook argument.

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

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

Код WC_Webhook::should_deliver() WC 8.7.0

private function should_deliver( $arg ) {
	$should_deliver = $this->is_active() && $this->is_valid_topic() && $this->is_valid_action( $arg ) && $this->is_valid_resource( $arg ) && ! $this->is_already_processed( $arg );

	/**
	 * Let other plugins intercept deliver for some messages queue like rabbit/zeromq.
	 *
	 * @param bool       $should_deliver True if the webhook should be sent, or false to not send it.
	 * @param WC_Webhook $this The current webhook class.
	 * @param mixed      $arg First hook argument.
	 */
	return apply_filters( 'woocommerce_webhook_should_deliver', $should_deliver, $this, $arg );
}