Skip to content

Commit

Permalink
Finally handle correctly options with false as value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Lannoy committed Apr 10, 2020
1 parent d8e1162 commit ccc5a0d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions includes/system/class-option.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public static function site_get( $option, $default = null ) {
$default = self::$defaults[ $option ];
}
$val = get_option( APCM_PRODUCT_ABBREVIATION . '_' . $option, $default );
if ( empty( $val ) && is_bool( $default ) ) {
return $default;
if ( is_bool( $default ) ) {
return (bool) $val;
}
return $val;
}
Expand All @@ -140,8 +140,8 @@ public static function network_get( $option, $default = null ) {
$default = self::$defaults[ $option ];
}
$val = get_site_option( APCM_PRODUCT_ABBREVIATION . '_' . $option, $default );
if ( empty( $val ) && is_bool( $default ) ) {
return $default;
if ( is_bool( $default ) ) {
return (bool) $val;
}
return $val;
}
Expand Down Expand Up @@ -193,9 +193,6 @@ public static function site_set( $option, $value, $autoload = null ) {
* @since 1.0.0
*/
public static function network_set( $option, $value ) {
if ( false === $value ) {
update_site_option( APCM_PRODUCT_ABBREVIATION . '_' . $option, true );
}
return update_site_option( APCM_PRODUCT_ABBREVIATION . '_' . $option, $value );
}

Expand Down

0 comments on commit ccc5a0d

Please sign in to comment.