For those having issues with dropdown fields in CF7 v5.2.1, the plugin now forces field values to be parsed as arrays rather than single values.
Here is the culprit code in the submission.php file,
if ( wpcf7_form_tag_supports( $type, 'selectable-values' ) ) {
$value = (array) $value;
if ( $tag->has_option( 'free_text' )
and isset( $posted_data[$name . '_free_text'] ) ) {
$last_val = array_pop( $value );
list( $tied_item ) = array_slice(
WPCF7_USE_PIPE ? $tag->pipes->collect_afters() : $tag->values,
-1, 1
);
$tied_item = html_entity_decode( $tied_item, ENT_QUOTES, 'UTF-8' );
if ( $last_val === $tied_item ) {
$value[] = sprintf( '%s %s',
$last_val,
$posted_data[$name . '_free_text']
);
} else {
$value[] = $last_val;
}
unset( $posted_data[$name . '_free_text'] );
}
}
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
$value_orig, $tag );
$posted_data[$name] = $value;
this will affect checkboxes and select (dropdown) fields. One potential way round this issue is to hook the filter wpcf7_posted_data_{$type}
in order to force the value back to a singular value,
add_filter('wpcf7_posted_data_select', 'force_singular_value',1,3);
add_filter('wpcf7_posted_data_select*', 'force_singular_value',1,3);
function force_singular_value($value, $original_submitted_value, $cf7_tag){
return original_submitted_value;
}
hopefully this should resolve the problems you’re facing.