Fix strict comparison for normal select, too.
This commit is contained in:
parent
e17e6d0b0f
commit
0fc6d4e20c
|
@ -230,7 +230,7 @@ function woocommerce_wp_select( $field ) {
|
|||
// The $key from $field['options'] could have been converted to integer automatically by PHP,
|
||||
// thus the comparison needs to check both $key and (string) $key in case $field['value'] is an array
|
||||
// with string values.
|
||||
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $field['value'] === $key || ( is_array( $field['value'] ) && ( in_array( $key, $field['value'], true ) || in_array( (string) $key, $field['value'], true ) ) ), true, false ) . '>' . esc_html( $value ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $field['value'] === (string) $key || ( is_array( $field['value'] ) && ( in_array( $key, $field['value'], true ) || in_array( (string) $key, $field['value'], true ) ) ), true, false ) . '>' . esc_html( $value ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue