• I’m using the following code in functions.php to turn off a number of default widgets so that they do not appear in the admin tools:

    function 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_Categories');
    
    	unregister_widget('WP_Widget_Recent_Comments');
    
    	unregister_widget('WP_Widget_RSS');
    
    	unregister_widget('WP_Widget_Tag_Cloud');
    }
    
    add_action('widgets_init', 'unregister_default_wp_widgets', 1);

    The problem I’m running into is that it is removing some widgets, but not others … namely, “Search” and “Meta,” which still appear on the Widgets page. Anyone know why?

Viewing 1 replies (of 1 total)
  • Same here, testing some variation of the same code gives me some results but not at all, Meta for example don’t want to go…
    I’m on 3.11 version.

Viewing 1 replies (of 1 total)
  • The topic ‘unregister_widget() not working for some widgets’ is closed to new replies.