WP_Customize_Nav_Menus::filter_dynamic_setting_args()
Filters a dynamic setting's constructor args.
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.
Method of the class: WP_Customize_Nav_Menus{}
No Hooks.
Return
Array|false
.
Usage
$WP_Customize_Nav_Menus = new WP_Customize_Nav_Menus(); $WP_Customize_Nav_Menus->filter_dynamic_setting_args( $setting_args, $setting_id );
- $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'].
Changelog
Since 4.3.0 | Introduced. |
WP_Customize_Nav_Menus::filter_dynamic_setting_args() WP Customize Nav Menus::filter dynamic setting args code WP 6.6.2
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; }