Title: WP_Customize_Manager::set_post_value
Published: April 23, 2015
Last modified: August 20, 2026

---

# WP_Customize_Manager::set_post_value( string $setting_id, mixed $value )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#wp--skip-link--target)

Overrides a setting’s value in the current customized state.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#description)󠁿

The name “post_value” is a carry-over from when the customized state was exclusively
sourced from `$_POST['customized']`.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#parameters)󠁿

 `$setting_id`stringrequired

ID for the [WP_Customize_Setting](https://developer.wordpress.org/reference/classes/wp_customize_setting/)
instance.

`$value`mixedrequired

Post value.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#source)󠁿

    ```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;

    	/**
    	 * Announces when a specific setting's unsanitized post value has been set.
    	 *
    	 * Fires when the WP_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 WP_Customize_Manager $manager WP_Customize_Manager instance.
    	 */
    	do_action( "customize_post_value_set_{$setting_id}", $value, $this );

    	/**
    	 * Announces when any setting's unsanitized post value has been set.
    	 *
    	 * Fires when the WP_Customize_Manager::set_post_value() method is called.
    	 *
    	 * This is useful for `WP_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 WP_Customize_Manager $manager    WP_Customize_Manager instance.
    	 */
    	do_action( 'customize_post_value_set', $setting_id, $value, $this );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-customize-manager.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-customize-manager.php#L1867)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-customize-manager.php#L1867-L1900)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#hooks)󠁿

 [do_action( ‘customize_post_value_set’, string $setting_id, mixed $value, WP_Customize_Manager $manager )](https://developer.wordpress.org/reference/hooks/customize_post_value_set/)

Announces when any setting’s unsanitized post value has been set.

 [do_action( “customize_post_value_set_{$setting_id}”, mixed $value, WP_Customize_Manager $manager )](https://developer.wordpress.org/reference/hooks/customize_post_value_set_setting_id/)

Announces when a specific setting’s unsanitized post value has been set.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Customize_Manager::unsanitized_post_values()](https://developer.wordpress.org/reference/classes/wp_customize_manager/unsanitized_post_values/)`wp-includes/class-wp-customize-manager.php` |

Gets dirty pre-sanitized setting values in the current customized state.

  | 
| [do_action()](https://developer.wordpress.org/reference/functions/do_action/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to an action hook.

  |

| Used by | Description | 
| [WP_Customize_Manager::save_changeset_post()](https://developer.wordpress.org/reference/classes/wp_customize_manager/save_changeset_post/)`wp-includes/class-wp-customize-manager.php` |

Saves the post for the loaded changeset.

  | 
| [WP_Customize_Manager::import_theme_starter_content()](https://developer.wordpress.org/reference/classes/wp_customize_manager/import_theme_starter_content/)`wp-includes/class-wp-customize-manager.php` |

Imports theme starter content into the customized state.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_post_value/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_manager%2Fset_post_value%2F)
before being able to contribute a note or feedback.