WordPress.org

Ready to get started?Download WordPress

Codex

Class Reference/WP Customize Manager/get setting

Contents

Description

$wp_customize->get_setting() can be used to modify properties of a setting that has already been created (for instance, one of WordPress's built-in settings).

This method is generally only used within the customize_register action hook.

Returns

This method returns an object matching any arguments provided in the $wp_customize->add_setting() method (default, type, capability, or transport)

Example

For example, if you needed to change the transport method of one of WordPress's built in theme settings, you might use one of the following...

$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';

if you needed to change a default (such as a default color), you might use...

$wp_customize->get_setting( 'header_textcolor' )->default = '#ffffff';
$wp_customize->get_setting( 'background_color' )->default = '#000000';

Related

See also index of Class Reference and index of Function Reference.