diff --git a/includes/admin/class-wc-admin-settings.php b/includes/admin/class-wc-admin-settings.php
index a14070723a1..c54d4be2f22 100644
--- a/includes/admin/class-wc-admin-settings.php
+++ b/includes/admin/class-wc-admin-settings.php
@@ -156,6 +156,10 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
* @return mixed
*/
public static function get_option( $option_name, $default = '' ) {
+ if ( ! $option_name ) {
+ return $default;
+ }
+
// Array value.
if ( strstr( $option_name, '[' ) ) {
@@ -227,6 +231,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
if ( ! isset( $value['suffix'] ) ) {
$value['suffix'] = '';
}
+ if ( ! isset( $value['value'] ) ) {
+ $value['value'] = self::get_option( $value['id'], $value['default'] );
+ }
// Custom attribute handling.
$custom_attributes = array();
@@ -285,7 +292,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
case 'email':
case 'url':
case 'tel':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
?>
@@ -309,7 +316,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Color picker.
case 'color':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
?>
|
@@ -337,7 +344,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Textarea.
case 'textarea':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
?>
@@ -363,7 +370,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Select boxes.
case 'select':
case 'multiselect':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
?>
@@ -404,7 +411,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Radio inputs.
case 'radio':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
?>
@@ -441,7 +448,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Checkbox input.
case 'checkbox':
- $option_value = self::get_option( $value['id'], $value['default'] );
+ $option_value = $value['value'];
$visibility_class = array();
if ( ! isset( $value['hide_if_checked'] ) ) {
@@ -547,7 +554,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
'show_option_none' => ' ',
'class' => $value['class'],
'echo' => false,
- 'selected' => absint( self::get_option( $value['id'], $value['default'] ) ),
+ 'selected' => absint( $value['value'] ),
'post_status' => 'publish,private,draft',
);
@@ -569,7 +576,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Single country selects.
case 'single_select_country':
- $country_setting = (string) self::get_option( $value['id'], $value['default'] );
+ $country_setting = (string) $value['value'];
if ( strstr( $country_setting, ':' ) ) {
$country_setting = explode( ':', $country_setting );
@@ -594,7 +601,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Country multiselects.
case 'multi_select_countries':
- $selections = (array) self::get_option( $value['id'], $value['default'] );
+ $selections = (array) $value['value'];
if ( ! empty( $value['options'] ) ) {
$countries = $value['options'];
@@ -631,7 +638,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
'months' => __( 'Month(s)', 'woocommerce' ),
'years' => __( 'Year(s)', 'woocommerce' ),
);
- $option_value = wc_parse_relative_date_option( self::get_option( $value['id'], $value['default'] ) );
+ $option_value = wc_parse_relative_date_option( $value['value'] );
?>
@@ -734,7 +741,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
// Loop options and get values to save.
foreach ( $options as $option ) {
- if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
+ if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) || ( isset( $option['is_option'] ) && false === $option['is_option'] ) ) {
continue;
}
|