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?

1 Answer 1


something like:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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