• 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/

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