Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'is_active_sidebar', function( $is_active_sidebar, $index ) {
- global $wp_registered_widgets;
- $widgets = wp_get_sidebars_widgets();
- $widget_area_contents = $widgets[ $index ];
- $active_widget_count = count( $widget_area_contents );
- foreach ( $widgets[ $index ] as $widget_instance ) {
- if ( ! array_key_exists( $widget_instance, $wp_registered_widgets ) ) {
- $active_widget_count--;
- }
- }
- return ( 0 < $active_widget_count );
- }, 10 , 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement