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.

My widget has a lot of dependent plugins, and disabling one of the plugins results in erratic behavior throughout my entire WP installation.

I've been trying to use the function is_plugin_active('Widget_Class_Name') with little to no luck thus far. Is there an effective way to remove the widget altogether if one of its dependent plugins are inactive?

share|improve this question
add comment

1 Answer

well first of all, is_plugin_active takes the name of the plugin sub-directory/file, so passing it a classname won't work. I'm not sure why you're passing anything widget related if you're checking for plugins your widget depends on.

other options are php's class_exists and function_exists to check if plugin functions your widget uses exist. check in the widgets init hook and don't register your widget if a class or function it depends on doesn't exist.

share|improve this answer
    
I actually meant to talk about unregister_widget("Widget_Class_Name") - sorry about that. –  Jim Johnson Jul 12 '12 at 17:17
add comment

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.