WC_Webhook::is_valid_action()privateWC 3.6.0

Validates the criteria for certain actions.

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

Хуков нет.

Возвращает

true|false. True if validation passes.

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

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

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

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

Код WC_Webhook::is_valid_action() WC 8.7.0

private function is_valid_action( $arg ) {
	$current_action = current_action();
	$return         = true;

	switch ( $current_action ) {
		case 'delete_post':
		case 'wp_trash_post':
		case 'untrashed_post':
			$return = $this->is_valid_post_action( $arg );
			break;
		case 'delete_user':
			$return = $this->is_valid_user_action( $arg );
			break;
	}

	if ( 0 === strpos( $current_action, 'woocommerce_process_shop' ) || 0 === strpos( $current_action, 'woocommerce_process_product' ) ) {
		$return = $this->is_valid_processing_action( $arg );
	}

	return $return;
}