Building a plugin that doesn’t break when deactivated

The other option would be to use any hooks available in the Theme, which would allow your Plugin to inject the slider at a filter or action hook. If the Plugin is deactivated, its add_action() or add_filter() call is never run, nothing attempts to be added to the template, and, voila: no breakage.

But, barring that (and since Themes that offer such custom hooks are still in the minority), function_exists() wrapper is the way to go. So +1 to @rmlumley.

Leave a Comment