WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been working with widgets a lot lately and have amassed a ton of widgets in the inactive widgets collection.

Can someone share a script or plugin that will remove all inactive widgets from the site?

share|improve this question
up vote 3 down vote accepted

something like:

$widgets = get_option('sidebars_widgets');
$widgets['wp_inactive_widgets'] = array();
update_option('sidebars_widgets', $widgets);
share|improve this answer
@OTP: Works great. What if I want to remove ALL widgets? – Scott B Mar 30 '11 at 18:02
then the second line should be $widgets = array(); or just use update_option('sidebars_widgets', array()); – onetrickpony Mar 30 '11 at 18:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.