Title: Small Improvement
Last modified: August 21, 2016

---

# Small Improvement

 *  [duckzland](https://wordpress.org/support/users/duckzland/)
 * (@duckzland)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/small-improvement/)
 * Seems that the plugin at current state only removing the content of the widget.
 * This will cause other plugin or theme very hard to determine if the sidebar actually
   contains widget or not.
 * A small improvement in code on method maybe_unset_widget() to really deregister
   the widget if user configure it to be hidden :
 *     ```
       function maybe_unset_widget( $sidebars_widgets ) {
       			foreach( $sidebars_widgets as $widget_area => $widget_list ) {
       			if ( $widget_area == 'wp_inactive_widgets' || empty( $widget_list ))
       				continue;
   
       			foreach( $widget_list as $pos => $widget_id ) {
       				if ( ! $this->check_widget_visibility( $widget_id ) ) {
       					unset( $sidebars_widgets[$widget_area][$pos] );
       				  wp_unregister_sidebar_widget($widget_id);
       				}
       			}
       		}
       		return $sidebars_widgets;
       	}
       ```
   
 * With this improvement, theme can just check the sidebar by calling wp_get_sidebars_widget()
   and check if the sidebar array is empty or not.
 * [https://wordpress.org/plugins/widget-context/](https://wordpress.org/plugins/widget-context/)

The topic ‘Small Improvement’ is closed to new replies.

 * ![](https://ps.w.org/widget-context/assets/icon-256x256.png?rev=1919865)
 * [Widget Context](https://wordpress.org/plugins/widget-context/)
 * [Support Threads](https://wordpress.org/support/plugin/widget-context/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-context/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-context/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-context/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [duckzland](https://wordpress.org/support/users/duckzland/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/small-improvement/)
 * Status: not resolved