Ticket #33602: 33602.diff
File 33602.diff, 1.4 KB (added by , 8 years ago) |
---|
-
wp-includes/widget-functions.php
739 739 * @return bool true if the sidebar is in use, false otherwise. 740 740 */ 741 741 function is_active_sidebar( $index ) { 742 $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);743 $sidebars_widgets = wp_get_sidebars_widgets();744 $is_active_sidebar = ! empty( $sidebars_widgets[ $index] );742 $index = ( is_int( $index ) ) ? "sidebar-$index" : sanitize_title( $index ); 743 $sidebars_widgets = wp_get_sidebars_widgets(); 744 $is_active_sidebar = ! empty( $sidebars_widgets[ $index ] ); 745 745 746 746 /** 747 * Addresses case where a widget instance is still in sidebars_widgets but 748 * is not actually registered. 749 * 750 * @ticket 33602 751 */ 752 if ( true === $is_active_sidebar ) { 753 754 global $wp_registered_widgets; 755 $widget_area_contents = $sidebars_widgets[ $index ]; 756 $active_widget_count = count( $widget_area_contents ); 757 758 foreach ( $widget_area_contents as $widget_instance ) { 759 760 if ( ! array_key_exists( $widget_instance, $wp_registered_widgets ) ) { 761 $active_widget_count--; 762 } 763 } 764 $is_active_sidebar = ( 0 < $active_widget_count ); 765 } 766 767 /** 747 768 * Filter whether a dynamic sidebar is considered "active". 748 769 * 749 770 * @since 3.9.0