WP_Customize_Setting::set_root_value()
Set the root value for a setting, especially for multidimensional ones.
Method of the class: WP_Customize_Setting{}
No Hooks.
Return
true|false
. Whether the multidimensional root was updated successfully.
Usage
// protected - for code of main (parent) or child class $result = $this->set_root_value( $value );
- $value(mixed) (required)
- Value to set as root of multidimensional setting.
Changelog
Since 4.4.0 | Introduced. |
WP_Customize_Setting::set_root_value() WP Customize Setting::set root value code WP 6.4.3
protected function set_root_value( $value ) { $id_base = $this->id_data['base']; if ( 'option' === $this->type ) { $autoload = true; if ( isset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] ) ) { $autoload = self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload']; } return update_option( $id_base, $value, $autoload ); } elseif ( 'theme_mod' === $this->type ) { set_theme_mod( $id_base, $value ); return true; } else { /* * Any WP_Customize_Setting subclass implementing aggregate multidimensional * will need to override this method to obtain the data from the appropriate * location. */ return false; } }