WordPress at Your Fingertips
function is not described

WC_Webhook::is_valid_post_action() private WC 3.6.0

Validates post actions.

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

No Hooks.

Return

true|false. True if validation passes.

Usage

// private - for code of main (parent) class only
$result = $this->is_valid_post_action( $arg );
$arg(mixed) (required)
First hook argument.

Changelog

Since 3.6.0 Introduced.

Code of WC_Webhook::is_valid_post_action() WC 6.1.1

private function is_valid_post_action( $arg ) {
	// Only deliver deleted/restored event for coupons, orders, and products.
	if ( isset( $GLOBALS['post_type'] ) && ! in_array( $GLOBALS['post_type'], array( 'shop_coupon', 'shop_order', 'product' ), true ) ) {
		return false;
	}

	// Check if is delivering for the correct resource.
	if ( isset( $GLOBALS['post_type'] ) && str_replace( 'shop_', '', $GLOBALS['post_type'] ) !== $this->get_resource() ) {
		return false;
	}
	return true;
}