Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mintplugins/cac5162afa0ea31444fdb7fc052b55cf to your computer and use it in GitHub Desktop.
Save mintplugins/cac5162afa0ea31444fdb7fc052b55cf to your computer and use it in GitHub Desktop.
function get_dir_and_filename_of_active_plugin( $plugin_filename = 'akismet.php' ) {
$plugin_dir_and_filename = false;
$active_plugins = get_option( 'active_plugins' );
foreach ( $active_plugins as $active_plugin ) {
if ( false !== strpos( $active_plugin, $plugin_filename ) ) {
$plugin_dir_and_filename = $active_plugin;
break;
}
}
return $plugin_dir_and_filename;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment