Skip to content

Commit 446a7ed

Browse files
committed
Align canonical Settings API behavior
1 parent 8ddae14 commit 446a7ed

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎class-options-api.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public static function update_option( $key = '', $value = false ) {
225225
}
226226

227227
$options = get_option( self::SETTINGS_OPTION, array() );
228+
$options = is_array( $options ) ? $options : array();
228229

229230
/**
230231
* Filters the value before it is saved.
@@ -284,6 +285,7 @@ public static function delete_option( $key = '' ) {
284285
}
285286

286287
$options = get_option( self::SETTINGS_OPTION, array() );
288+
$options = is_array( $options ) ? $options : array();
287289

288290
if ( isset( $options[ $key ] ) ) {
289291
unset( $options[ $key ] );

‎settings/class-settings-form.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ public function callback_number( $args ) {
997997
$value = $this->get_field_value( $args );
998998
$max = isset( $args['max'] ) ? intval( $args['max'] ) : 999999;
999999
$min = isset( $args['min'] ) ? intval( $args['min'] ) : 0;
1000-
$step = isset( $args['step'] ) ? intval( $args['step'] ) : 1;
1000+
$step = isset( $args['step'] ) && ( is_numeric( $args['step'] ) || 'any' === $args['step'] ) ? $args['step'] : 1;
10011001
$size = $args['size'] ?? 'regular';
10021002
$placeholder = $this->get_placeholder_attribute( $args );
10031003
$attributes = $this->get_boolean_attributes( $args );

‎settings/js/tom-select-init.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)