HomeTips & Tricks How to remove or disable default widget in WordPress

How to remove or disable default widget in WordPress

How To Remove Or Disable Default Widget In WordPress
How To Remove Or Disable Default Widget In WordPress

Do you want to disable or remove unused widgets in from your WordPress site? Just copy and paste the following given code into inside your theme folder’s functions.php file and save it.

// unregister all widgets
function unregister_default_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_Media_Gallery’);
unregister_widget(‘WP_Widget_Media_Audio’);
unregister_widget(‘WP_Widget_Media_Video’);
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_Nav_Menu_Widget’);
unregister_widget(‘Twenty_Eleven_Ephemera_Widget’);
}
add_action(‘widgets_init’, ‘unregister_default_widgets’, 11);
Here above you can customize or remove any line code per your needs.

In the end

I hope you have found this article helpful. Let us me your opinion or questions if any through the comment form in below or use this form to ask your question.

You May Also Like

About the Author: Kedar Adhikari

I am WordPress Themes developer and designer and also any type of website design with minimum cost. for more information you can contact me on email gojinepal@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2020 My WP Helper. All rights reserved.