diff --git a/lib/class-wp-rest-settings-controller.php b/lib/class-wp-rest-settings-controller.php index 3381a9d..fb16d25 100644 --- a/lib/class-wp-rest-settings-controller.php +++ b/lib/class-wp-rest-settings-controller.php @@ -93,14 +93,15 @@ public function update_item( $request ) { $params = $request->get_params(); foreach ( $options as $name => $args ) { - if ( array_key_exists( $name, $params ) ) { - // A null value means reset the option, which is essentially deleting it - // from the database and then relying on the default value. - if ( is_null( $request[ $name ] ) ) { - delete_option( $args['option_name'] ); - } else { - update_option( $args['option_name'], $request[ $name ] ); - } + if ( ! array_key_exists( $name, $params ) ) { + continue; + } + // A null value means reset the option, which is essentially deleting it + // from the database and then relying on the default value. + if ( is_null( $request[ $name ] ) ) { + delete_option( $args['option_name'] ); + } else { + update_option( $args['option_name'], $request[ $name ] ); } }