Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
continue early.
Browse files Browse the repository at this point in the history
  • Loading branch information
joehoyle committed Sep 22, 2016
1 parent 5008108 commit dcacb38
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/class-wp-rest-settings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
}
}

Expand Down

0 comments on commit dcacb38

Please sign in to comment.