Title: WP_Customize_Setting::value
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Customize_Setting::value(): mixed

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#changelog)

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

Fetch the value of the setting.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#return)󠁿

 mixed The value.

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

    ```php
    public function value() {
    	$id_base      = $this->id_data['base'];
    	$is_core_type = ( 'option' === $this->type || 'theme_mod' === $this->type );

    	if ( ! $is_core_type && ! $this->is_multidimensional_aggregated ) {

    		// Use post value if previewed and a post value is present.
    		if ( $this->is_previewed ) {
    			$value = $this->post_value( null );
    			if ( null !== $value ) {
    				return $value;
    			}
    		}

    		$value = $this->get_root_value( $this->default );

    		/**
    		 * Filters a Customize setting value not handled as a theme_mod or option.
    		 *
    		 * The dynamic portion of the hook name, `$id_base`, refers to
    		 * the base slug of the setting name, initialized from `$this->id_data['base']`.
    		 *
    		 * For settings handled as theme_mods or options, see those corresponding
    		 * functions for available hooks.
    		 *
    		 * @since 3.4.0
    		 * @since 4.6.0 Added the `$this` setting instance as the second parameter.
    		 *
    		 * @param mixed                $default_value The setting default value. Default empty.
    		 * @param WP_Customize_Setting $setting       The setting instance.
    		 */
    		$value = apply_filters( "customize_value_{$id_base}", $value, $this );
    	} elseif ( $this->is_multidimensional_aggregated ) {
    		$root_value = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
    		$value      = $this->multidimensional_get( $root_value, $this->id_data['keys'], $this->default );

    		// Ensure that the post value is used if the setting is previewed, since preview filters aren't applying on cached $root_value.
    		if ( $this->is_previewed ) {
    			$value = $this->post_value( $value );
    		}
    	} else {
    		$value = $this->get_root_value( $this->default );
    	}
    	return $value;
    }
    ```

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

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

 [apply_filters( “customize_value_{$id_base}”, mixed $default_value, WP_Customize_Setting $setting )](https://developer.wordpress.org/reference/hooks/customize_value_id_base/)

Filters a Customize setting value not handled as a theme_mod or option.

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

| Uses | Description | 
| [WP_Customize_Setting::get_root_value()](https://developer.wordpress.org/reference/classes/wp_customize_setting/get_root_value/)`wp-includes/class-wp-customize-setting.php` |

Get the root value for a setting, especially for multidimensional ones.

  | 
| [WP_Customize_Setting::multidimensional_get()](https://developer.wordpress.org/reference/classes/wp_customize_setting/multidimensional_get/)`wp-includes/class-wp-customize-setting.php` |

Will attempt to fetch a specific value from a multidimensional array.

  | 
| [WP_Customize_Setting::post_value()](https://developer.wordpress.org/reference/classes/wp_customize_setting/post_value/)`wp-includes/class-wp-customize-setting.php` |

Fetch and sanitize the $_POST value for the setting.

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

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/WP_Customize_Setting/value/?output_format=md#)

| Used by | Description | 
| [WP_Customize_Setting::js_value()](https://developer.wordpress.org/reference/classes/wp_customize_setting/js_value/)`wp-includes/class-wp-customize-setting.php` |

Sanitize the setting’s value for use in JavaScript.

  | 
| [WP_Customize_Setting::preview()](https://developer.wordpress.org/reference/classes/wp_customize_setting/preview/)`wp-includes/class-wp-customize-setting.php` |

Add filters to supply the setting’s value when accessed.

  |

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

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.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_setting%2Fvalue%2F)
before being able to contribute a note or feedback.