WC_Webhook::should_deliver()
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.
Method of the class: WC_Webhook{}
Hooks from the method
Return
true|false
. True if webhook should be delivered, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->should_deliver( $arg );
- $arg(mixed) (required)
- First hook argument.
Changelog
Since 2.2.0 | Introduced. |
WC_Webhook::should_deliver() WC Webhook::should deliver code WC 9.5.1
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 ); }