Daily Tips WordPress

How to: Unregister WordPress Default Widgets

0
1 0

Today I’m gonna show you a quick lesson which for most of you will be useful when developing a client’s website from scratch or even when you create a website starting with a theme. There are a lot of default widgets which most of the time you are not using them and takes a lot of space in your Widgets Page.

So why not get rid of them? To do this you need to follow few small steps:

Step 1: Open functions.php inside your active theme folder.

Step 2: Copy this entire function at the end of the file:

function stanleytips_unregister_default_wp_widgets() {
    unregister_widget('WP_Widget_Pages');
    unregister_widget('WP_Widget_Calendar');
    unregister_widget('WP_Widget_Archives');
    unregister_widget('WP_Widget_Links');
    unregister_widget('WP_Widget_Meta');
    unregister_widget('WP_Widget_Search');
    unregister_widget('WP_Widget_Text');
    unregister_widget('WP_Widget_Categories');
    unregister_widget('WP_Widget_Recent_Posts');
    unregister_widget('WP_Widget_Recent_Comments');
    unregister_widget('WP_Widget_RSS');
    unregister_widget('WP_Widget_Tag_Cloud');
}
add_action('widgets_init', 'stanleytips_unregister_default_wp_widgets', 1);

Before adding above code in my functions file my Appearance -> Widgets page had these widgets:

remove_default_widgets_1

Now, all widgets were unregistered using only one function, and the page now looks like:

remove_default_widgets_2

Final Note: When you are in a hurry and need to complete a website for a client, or when you build a theme and don’t have time to style all these default widget or any other reason this will be a very handy solution for you.

If you enjoy this article don’t forget to like and share it.

Thank you

Stanley
I am a self made webmaster, blogger, web technology enthusiast and founder of StanleyTips.com.
You may also like
display magento products on homepage
How to get SkinURL in Magento 2
Top 10 jQuery Gallery Plugins ready to be used in projects 2016

Leave Your Comment

Your Comment*

Your Name*
Your Webpage

23 + = 32

Enjoy This Article?

Join My Mailing List...

Facebook

Twitter

THANK YOU