WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer


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.