One of our users asked us if it was possible to remove inactive widgets in WordPress. Once you have tried out different themes and played along with many plugins, you will notice that a number of inactive widgets would start accumulating in your inactive widget area. When you stop using a widget or change a theme, your widgets are moved to inactive widgets area. This is done primarily to make sure that you don’t lose your widgets when changing WordPress themes. Removing inactive widgets manually takes some time because you have to click on each widget to open the drop down box containing the link to delete that widget. In this article we will show you how to remove inactive widgets in WordPress.
First thing you need to do is install and activate the Remove Inactive Widgets plugin. After activating the plugin, go to Appearance » Widgets. Inside the inactive widgets box you will see a button labeled Remove Inactive Widgets. Pressing the button will remove all your inactive widgets without even reloading the page.
For those who don’t like the plugin method, you can simply paste the following code in your theme’s functions.php file. All you have to do after that is reload the widgets page, and all your inactive widgets will be gone. Don’t forget to remove this code once you are done.
$widgets = get_option('sidebars_widgets'); $widgets['wp_inactive_widgets'] = array(); update_option('sidebars_widgets', $widgets);
We hope that this article helped you in removing inactive widgets in WordPress. If you have any questions related to this, then feel free to leave a comment below. For all other questions, please ask us on twitter (@wpbeginner).