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

Filters a dynamic setting’s constructor args.


Description 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.


Top ↑

Parameters Parameters

$setting_args

(false|array) (Required) The arguments to the WP_Customize_Setting constructor.

$setting_id

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


Top ↑

Return Return

(array|false)


Top ↑

Source 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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.