I am pretty sure that everyone who has ever installed WP has fiddled with widgets more than they wanna admit. Specifically with figuring out how to disable WordPress widgets because…well, it’s a pain creating, deleting, and remaking them. We add a text box here and hate it. So we delete it. Then we decide we like it. So we add it back and have to either rewrite or go find the code/copy we used in it all over again. And that’s not even taking into account the countless website redesigns we’ve all done where some widgets just don’t work for that design.

Here’s the kicker: you’re not even sure if that design works for your site. Or maybe you’re just experimenting with swapping different widgets in and out. Heck, you might even just hate that the widgets panel is overflowing with options and you want to pare them down a bit.

Whatever your reason, you need to know how to disable WordPress widgets. And if you don’t need to disable any right now…it’s just something good to know how to do later.

Plugins to Disable WordPress Widgets

Y’all probably know by now that I am a big fan of not using a plugin for something you can do just as easily (or almost just as easily) by hand. But not everyone is comfortable doing that. (It’s not as intimidating as it sounds, by the way.) So if you do wanna go the plugin route, these are a couple of the better options.

WP Widgets Disable

So when you want to disable WordPress widgets, the first go-to for many folks will be the WP Widgets Disable plugin.

It’s a crazy simple plugin to use–you go to Appearance -> Disable Widgets and pick which sidebar or dashboard widgets you want to disable. Once you save your settings, they’ve automagically vanished from sight. This is kind of the nuclear option, though, so be warned. You’re disabling the widgets entirely, not simply hiding them. If you’re planning on toggling them back on and off, you will want a different option. But if you’re sure you’ll straight-up not use them, you can’t go wrong here.

disable wordpress widgets

Widget Options

Another choice you can make, which gives you a slightly different take on disabling the widgets is Widget Options. Instead of disabling them so that you can’t see them, the plugin lets you disable WordPress widgets on a page-by-page or device-by-device basis (much like Divi allows you to control when and where modules appear).

The reason I wanted to include this is because you can still completely disable the widgets you’re not using with this. If you want to keep things configured the way you already have them, but don’t want a specific widget (or widgets) to show for a while, Widget Options will let you do that.

All you have to do is head to Settings -> Widget Options on your dashboard and make sure the Pages Visibility and Devices Restriction options are enabled.

disable wordpress widgets

Then, you can just go into your widgets panel and control each one by either device or page/custom post type. The only thing that may even remotely be issue here is that you don’t get to choose by specific posts (so you can’t make one widget only show up on a single blog entry, for instance), but if you want to disable the widgets you’re not using for a while, you have tons of customization with this.

disable WordPress widgets

Marking them Inactive

The default way that’s built in so you can disable WordPress widgets is actually mega-easy. If you want to completely disable something while maintaining all its settings, contents, and configurations still intact. All you have to do is drag the widget from your sidebar into the Inactive Widgets at the bottom of the Settings -> Widgets page. WordPress will disable the widget, and you can just drag it back into place whenever you want to re-enable it.

disable WordPress Widgets

The PHP Way or the Highway

Now, plugins great, but there is a way to disable WordPress widgets without having to worry about compatibility and plugins and all that. The WP Codex has a great page on widget functions, specifically on how to unregister widgets. The Codex also has a list of all the widget IDs.

Just open up your functions.php file and put in the code to disable whichever widgets you don’t want cluttering up your site. Let’s say you want to totally disable the default Tag Cloud widget because this isn’t 2005 anymore–you can just write something like this into the PHP files.

function unregister_default_wp_widgets() {

     unregister_widget('WP_Widget_Tag_Cloud');
}

add_action('widgets_init', 'unregister_default_wp_widgets' );

And with that, it won’t show up in the default list of widgets anymore. (You can also unregister as many widgets as you want; just add them on new lines in the function.)

This is basically what the WP Widgets Disable plugin does, only instead of taking up system resources and whatnot, you’re doing it the most efficient (in terms of server and site efficiency) way possible.. To reimplement the widgets you’ve disabled, you just edit the functions.phpfile again and just delete the code that lines up with the widget. It really is that simple.

I know that editing the WP PHP files can be super scary, but if you start out working with simple functions like this, you will get used to how it all works without affecting any major site-wide functionality. And be sure to always install a child theme before messing with any .php files to make sure you don’t blow something up by accident. (Also, remember that installing child themes helps with making sure WP and theme updates don’t remove your customizations and reinstate the widgets you’ve already disabled.)

The More You Know

Hopefully, if you’re looking to disable WordPress widgets you’re not using, there’s an option here for you. Like I said, I highly suggest the functions.php + child theme method just because I like working without plugins as much as possible. But if you’re not cool with that, you can nuke them with plugins or just drag them and put them in the corner for a while in timeout.

Regardless of the why, you have a lot of options to tidy up your site.

Article featured image by wowomnom / shutterstock.com

The post How to Disable WordPress Widgets You’re Not Using appeared first on Elegant Themes Blog.