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 ) ) {