WP_Customize_Nav_Menus::filter_dynamic_setting_args( false|array $setting_args, string $setting_id )

Filters a dynamic setting’s constructor args.


Description

For a dynamic setting to be registered, this filter must be employed to override the default false value with an array of args to pass to the WP_Customize_Setting constructor.


Parameters

$setting_args

(Required) The arguments to the WP_Customize_Setting constructor.

$setting_id

(Required) ID for dynamic setting, usually coming from $_POST['customized'].


Return

(array|false)


Source

File: wp-includes/class-wp-customize-nav-menus.php

	public function filter_dynamic_setting_args( $setting_args, $setting_id ) {
		if ( preg_match( WP_Customize_Nav_Menu_Setting::ID_PATTERN, $setting_id ) ) {
			$setting_args = array(
				'type'      => WP_Customize_Nav_Menu_Setting::TYPE,
				'transport' => 'postMessage',
			);
		} elseif ( preg_match( WP_Customize_Nav_Menu_Item_Setting::ID_PATTERN, $setting_id ) ) {
			$setting_args = array(
				'type'      => WP_Customize_Nav_Menu_Item_Setting::TYPE,
				'transport' => 'postMessage',
			);
		}
		return $setting_args;
	}

Changelog

Changelog
Version Description
WP-4.3.0 Introduced.