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?


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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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