WP_Customize_Nav_Menus::filter_dynamic_setting_args() WordPress Method

The WP_Customize_Nav_Menus::filter_dynamic_setting_args() Wordpress method is used to filter the dynamic setting args.

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.


Top ↑

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

(array|false)


Top ↑

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
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.