Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Webhook::is_valid_resource( mixed $arg )
Checks the resource for this webhook is valid e.g. valid post status.
Description Description
Parameters Parameters
- $arg
-
(Required) First hook argument.
Return Return
(bool) True if validation passes.
Source Source
File: includes/class-wc-webhook.php
private function is_valid_resource( $arg ) { $resource = $this->get_resource(); if ( in_array( $resource, array( 'order', 'product', 'coupon' ), true ) ) { $status = get_post_status( absint( $arg ) ); // Ignore auto drafts for all resources. if ( in_array( $status, array( 'auto-draft', 'new' ), true ) ) { return false; } // Ignore standard drafts for orders. if ( 'order' === $resource && 'draft' === $status ) { return false; } // Check registered order types for order types args. if ( 'order' === $resource && ! in_array( get_post_type( absint( $arg ) ), wc_get_order_types( 'order-webhooks' ), true ) ) { return false; } } return true; }
Changelog Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |