← All changes
|
admin/classes/admin-options/fields/checkbox-multiple/template.php
+5
-1
2.3.1
→
2.3.2
View file →
| @@ -14,14 +14,18 @@ | ||
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if ( ! empty( $settings['options'] ) ) : |
| 18 | + // Both sides as strings: an option list can be keyed by integers while a | |
| 19 | + // saved value is always a list of strings. | |
| 20 | + $saved = array_map( 'strval', (array) $value ); | |
| 21 | + | |
| 18 | 22 | foreach ( $settings['options'] as $key => $option ) : ?> |
| 19 | 23 | <label> |
| 20 | 24 | <input |
| 21 | 25 | type="checkbox" name="merchant[<?php echo esc_attr( $settings['id'] ); ?>][]" |
| 22 | 26 | value="<?php echo esc_attr( $key ); ?>" |
| 23 | - <?php checked( in_array( $key, $value, true ), true ); ?> | |
| 27 | + <?php checked( in_array( (string) $key, $saved, true ), true ); ?> | |
| 24 | 28 | /> |
| 25 | 29 | <span><?php echo esc_html( $option ); ?></span> |
| 26 | 30 | </label> |
| 27 | 31 | <?php |