Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I wonder if possible to disable a widget that belongs to a plugin that is currently active w/o touching the plugin code.

For sample, I normally use a code like this to disable wordpress widgets,

 unregister_widget('WP_Widget_Text');

Now, I want to also deactivate let's say for sample the widget called "The other Widget"

is that possible?

Thanks in advanced.

share|improve this question
    
you can't unregister it in your theme's function.php using a higher priority than the plugin is using? –  BandonRandon Dec 28 '11 at 8:52
    
that was my first thought, however didn't work for me –  andresmijares25 Dec 28 '11 at 8:56

1 Answer 1

up vote 2 down vote accepted

You must use widgets_init hook with a high priority for example this will remove the default WP Widgets

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_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', 'unregister_default_wp_widgets', 1);
share|improve this answer
    
Hi, thanks for your answer, but as I showed in my example, I've already tried with it, however I'm looking to disable other plugins which are from other plugins, like nextgen gallery, or meteor slide, or whatever. Any guessing? –  andresmijares25 Dec 28 '11 at 21:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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