From dcacb3839c0cdc854d3ff5a04dfffdf1a0c92fca Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Thu, 22 Sep 2016 15:23:53 -0400 Subject: [PATCH] `continue` early. --- lib/class-wp-rest-settings-controller.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 ] ); } }