Skip to content

Instantly share code, notes, and snippets.

@Jany-M
Created August 12, 2015 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Jany-M/8aa4519997e7e8f7cd0d to your computer and use it in GitHub Desktop.
Save Jany-M/8aa4519997e7e8f7cd0d to your computer and use it in GitHub Desktop.
[WordPress] Check from Frontend/Theme if a plugin is active
<?php // Check from theme if a plugin is active - Place in functions.php or similar
if(!function_exists('plugin_is_active')) {
function plugin_is_active($plugin_folder, $plugin_file) {
if(!isset($plugin_file) || $plugin_file == '') $plugin_file = $plugin_folder;
return in_array($plugin_folder.'/'.$plugin_file.'.php', apply_filters('active_plugins', get_option('active_plugins')));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment