Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. add_filter( 'is_active_sidebar', function( $is_active_sidebar, $index ) {
  2.  
  3. global $wp_registered_widgets;
  4. $widgets = wp_get_sidebars_widgets();
  5.  
  6. $widget_area_contents = $widgets[ $index ];
  7. $active_widget_count = count( $widget_area_contents );
  8.  
  9. foreach ( $widgets[ $index ] as $widget_instance ) {
  10.  
  11. if ( ! array_key_exists( $widget_instance, $wp_registered_widgets ) ) {
  12. $active_widget_count--;
  13. }
  14. }
  15. return ( 0 < $active_widget_count );
  16. }, 10 , 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement