From 35dbc7c6c813206240f63a1ade5b5998e1992b7e Mon Sep 17 00:00:00 2001 From: Guilherme Capanema Date: Mon, 6 Jul 2020 16:30:55 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20valida=C3=A7=C3=A3o=20de=20campos=20o?= =?UTF-8?q?pcionais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/class-cf7-states-cities-public.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/class-cf7-states-cities-public.php b/public/class-cf7-states-cities-public.php index e208cf7..7e7f578 100644 --- a/public/class-cf7-states-cities-public.php +++ b/public/class-cf7-states-cities-public.php @@ -274,7 +274,7 @@ class Cf7_States_Cities_Public { $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); } - if ( $tag->type === 'state' || $tag->type === 'state*' ) { + if ( !$empty && ( $tag->type === 'state' || $tag->type === 'state*' ) ) { $states = require( plugin_dir_path( __FILE__ ) . '../data/states.php' ); if ( !in_array( $_POST[$name], $states ) ) { @@ -282,7 +282,7 @@ class Cf7_States_Cities_Public { } } - if ( $tag->type === 'city' || $tag->type === 'city*' ) { + if ( !$empty && ( $tag->type === 'city' || $tag->type === 'city*' ) ) { $cities = require( plugin_dir_path( __FILE__ ) . '../data/cities.php' ); if ( !in_array( $_POST[$name], $cities ) ) {