The is_wide_widget_in_customizer WordPress PHP Filter allows you to determine if a given widget is considered “wide” in the customizer.
Usage
apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id );
Parameters
$is_wide
(bool) – Whether the widget is wide. Default is false.$widget_id
(string) – The widget ID.
More information
See WordPress Developer Resources: is_wide_widget_in_customizer
Examples
Make a specific widget wide
Set a specific widget to be wide in the customizer.
function wide_widget_example( $is_wide, $widget_id ) { if ( 'text-2' == $widget_id ) { return true; } return $is_wide; } add_filter( 'is_wide_widget_in_customizer', 'wide_widget_example', 10, 2 );
Make all text widgets wide
Set all text widgets to be wide in the customizer.
function all_text_widgets_wide( $is_wide, $widget_id ) { if ( strpos( $widget_id, 'text-' ) === 0 ) { return true; } return $is_wide; } add_filter( 'is_wide_widget_in_customizer', 'all_text_widgets_wide', 10, 2 );
Make all widgets wide
Set all widgets to be wide in the customizer.
function all_widgets_wide( $is_wide, $widget_id ) { return true; } add_filter( 'is_wide_widget_in_customizer', 'all_widgets_wide', 10, 2 );
Make all wide widgets narrow
Set all wide widgets to be narrow in the customizer.
function all_wide_widgets_narrow( $is_wide, $widget_id ) { return false; } add_filter( 'is_wide_widget_in_customizer', 'all_wide_widgets_narrow', 10, 2 );
Make wide widgets based on custom logic
Set widgets to be wide based on custom logic.
function custom_logic_wide_widgets( $is_wide, $widget_id ) { // Custom logic to determine if a widget should be wide if ( /* your custom code here */ ) { return true; } return $is_wide; } add_filter( 'is_wide_widget_in_customizer', 'custom_logic_wide_widgets', 10, 2 );