GC_Customize_Manager::set_post_value()
最后更新于:2021-11-27 02:20:09
GC_Customize_Manager::set_post_value( string$setting_id, mixed$value)Override a setting’s value in the current customized state.
参数
- $setting_id
-
(string) (Required) ID for the GC_Customize_Setting instance.
- $value
-
(mixed) (Required) Post value.
源文件
文件: gc-includes/class-gc-customize-manager.php
public function set_post_value( $setting_id, $value ) {
$this->unsanitized_post_values(); // Populate _post_values from $_POST['customized'].
$this->_post_values[ $setting_id ] = $value;
/**
* Announce when a specific setting's unsanitized post value has been set.
*
* Fires when the GC_Customize_Manager::set_post_value() method is called.
*
* The dynamic portion of the hook name, `$setting_id`, refers to the setting ID.
*
* @since 4.4.0
*
* @param mixed $value Unsanitized setting post value.
* @param GC_Customize_Manager $this GC_Customize_Manager instance.
*/
do_action( "customize_post_value_set_{$setting_id}", $value, $this );
/**
* Announce when any setting's unsanitized post value has been set.
*
* Fires when the GC_Customize_Manager::set_post_value() method is called.
*
* This is useful for `GC_Customize_Setting` instances to watch
* in order to update a cached previewed value.
*
* @since 4.4.0
*
* @param string $setting_id Setting ID.
* @param mixed $value Unsanitized setting post value.
* @param GC_Customize_Manager $this GC_Customize_Manager instance.
*/
do_action( 'customize_post_value_set', $setting_id, $value, $this );
}