WP_Customize_Nav_Menus::filter_dynamic_setting_class()publicWP 4.3.0

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

Method of the class: WP_Customize_Nav_Menus{}

No Hooks.

Return

String.

Usage

$WP_Customize_Nav_Menus = new WP_Customize_Nav_Menus();
$WP_Customize_Nav_Menus->filter_dynamic_setting_class( $setting_class, $setting_id, $setting_args );
$setting_class(string) (required)
WP_Customize_Setting or a subclass.
$setting_id(string) (required)
ID for dynamic setting, usually coming from $_POST['customized'].
$setting_args(array) (required)
WP_Customize_Setting or a subclass.

Changelog

Since 4.3.0 Introduced.

WP_Customize_Nav_Menus::filter_dynamic_setting_class() code WP 6.6.2

public function filter_dynamic_setting_class( $setting_class, $setting_id, $setting_args ) {
	unset( $setting_id );

	if ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Setting::TYPE === $setting_args['type'] ) {
		$setting_class = 'WP_Customize_Nav_Menu_Setting';
	} elseif ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Item_Setting::TYPE === $setting_args['type'] ) {
		$setting_class = 'WP_Customize_Nav_Menu_Item_Setting';
	}
	return $setting_class;
}