Skip to content

Commit 09201ee

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

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
@@ -427,12 +427,7 @@ public static function execute_update_settings( $input = array() ): array {
427427
$current_value = self::cast_value( get_option( $option_name ), $setting_type );
428428
$sanitized_value = self::cast_value( $sanitized_value, $setting_type );
429429

430-
if ( $updated || $current_value === $sanitized_value ) {
431-
if ( ! isset( $updated_settings[ $group ] ) ) {
432-
$updated_settings[ $group ] = array();
433-
}
434-
$updated_settings[ $group ][ $option_name ] = $current_value;
435-
} else {
430+
if ( ! $updated && $current_value !== $sanitized_value ) {
436431
return new WP_Error(
437432
'rest_setting_update_failed',
438433
sprintf(
@@ -443,6 +438,12 @@ public static function execute_update_settings( $input = array() ): array {
443438
array( 'status' => 500 )
444439
);
445440
}
441+
442+
if ( ! isset( $updated_settings[ $group ] ) ) {
443+
$updated_settings[ $group ] = array();
444+
}
445+
446+
$updated_settings[ $group ][ $option_name ] = $current_value;
446447
}
447448
}
448449

0 commit comments

Comments
 (0)