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
false|arrayrequired- The arguments to the WP_Customize_Setting constructor.
$setting_id
stringrequired- ID for dynamic setting, usually coming from
$_POST['customized']
.
Source
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
Version | Description |
---|---|
4.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.