Skip to content

Commit 13c9e86

Browse files
Update src/wp-includes/abilities/class-wp-settings-abilities.php
Co-authored-by: Dovid Levine <justlevine@gmail.com>
1 parent ec9627e commit 13c9e86

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/wp-includes/abilities/class-wp-settings-abilities.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,7 @@ public static function execute_update_settings( $input = array() ): array {
432432
$current_value = self::cast_value( get_option( $option_name ), $setting_type );
433433
$sanitized_value = self::cast_value( $sanitized_value, $setting_type );
434434

435-
if ( $updated || $current_value === $sanitized_value ) {
436-
if ( ! isset( $updated_settings[ $group ] ) ) {
437-
$updated_settings[ $group ] = array();
438-
}
439-
$updated_settings[ $group ][ $option_name ] = $current_value;
440-
} else {
435+
if ( ! $updated && $current_value !== $sanitized_value ) {
441436
return new WP_Error(
442437
'rest_setting_update_failed',
443438
sprintf(
@@ -448,6 +443,12 @@ public static function execute_update_settings( $input = array() ): array {
448443
array( 'status' => 500 )
449444
);
450445
}
446+
447+
if ( ! isset( $updated_settings[ $group ] ) ) {
448+
$updated_settings[ $group ] = array();
449+
}
450+
451+
$updated_settings[ $group ][ $option_name ] = $current_value;
451452
}
452453
}
453454

0 commit comments

Comments
 (0)