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?


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 '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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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