customize_dynamic_setting_class filter-hookWP 4.2.0

Allow non-statically created settings to be constructed with custom WP_Customize_Setting subclass.

Usage

add_filter( 'customize_dynamic_setting_class', 'wp_kama_customize_dynamic_setting_class_filter', 10, 3 );

/**
 * Function for `customize_dynamic_setting_class` filter-hook.
 * 
 * @param string $setting_class WP_Customize_Setting or a subclass.
 * @param string $setting_id    ID for dynamic setting, usually coming from `$_POST['customized']`.
 * @param array  $setting_args  WP_Customize_Setting or a subclass.
 *
 * @return string
 */
function wp_kama_customize_dynamic_setting_class_filter( $setting_class, $setting_id, $setting_args ){

	// filter...
	return $setting_class;
}
$setting_class(string)
WP_Customize_Setting or a subclass.
$setting_id(string)
ID for dynamic setting, usually coming from $_POST['customized'].
$setting_args(array)
WP_Customize_Setting or a subclass.

Changelog

Since 4.2.0 Introduced.

Where the hook is called

WP_Customize_Manager::add_dynamic_settings()
customize_dynamic_setting_class
WP_Customize_Manager::add_setting()
customize_dynamic_setting_class
wp-includes/class-wp-customize-manager.php 3835
$setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args );
wp-includes/class-wp-customize-manager.php 3775
$class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args );

Where the hook is used in WordPress

wp-includes/class-wp-customize-nav-menus.php 51
add_filter( 'customize_dynamic_setting_class', array( $this, 'filter_dynamic_setting_class' ), 10, 3 );