add( 'error_no_nonce_match', esc_html__( 'Something went wrong, please try again.', 'acf-city-selector' ) ); return; } else { $search_criteria_state = ( ! empty( $_POST[ 'acfcs_state' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'acfcs_state' ] ) ) : false; $search_criteria_country = ( ! empty( $_POST[ 'acfcs_country' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'acfcs_country' ] ) ) : false; $searched_orderby = ( ! empty( $_POST[ 'acfcs_orderby' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'acfcs_orderby' ] ) ) : false; $searched_term = ( ! empty( $_POST[ 'acfcs_search' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'acfcs_search' ] ) ) : false; $selected_limit = ( ! empty( $_POST[ 'acfcs_limit' ] ) ) ? (int) $_POST[ 'acfcs_limit' ] : $limit; } } // if there is at least 1 country if ( ! empty( $all_countries ) ) { foreach ( $all_countries as $country_code => $country_name ) { $countries[] = [ 'code' => $country_code, 'name' => esc_attr( $country_name ), ]; } } // if user has searched if ( isset( $_POST[ 'acfcs_search_form' ] ) ) { $cities = acfcs_get_searched_cities(); foreach( $cities as $key => $city_object ) { $city_object->country = acfcs_get_country_name( strtolower( $city_object->country_code ) ); $city_array[] = (array) $city_object; } if ( ! empty( $city_array ) ) { uasort( $city_array, 'acfcs_sort_array_with_quotes' ); } $result_count = count( $city_array ); } ?>