Skip to content

Instantly share code, notes, and snippets.

@steveclason
Created December 30, 2016 18:28
Show Gist options
  • Save steveclason/9474a37858cd754bf928a9c14b3a0ec3 to your computer and use it in GitHub Desktop.
Save steveclason/9474a37858cd754bf928a9c14b3a0ec3 to your computer and use it in GitHub Desktop.
<?php
/*
* Print a list of active WordPress Plugins.
* Put this in a template file you can see or hide it and use DevTools to view it.
* Useful for troubleshooting perfomance problems in sites with many plugins.
*/
// Check if get_plugins() function exists. This is required on the front end of the
// site, since it is in a file that is normally only loaded in the admin.
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// Get an array of all plugins.
$all_plugins = get_plugins();
echo '<pre>';
// If a plugin is active print the name.
foreach( $all_plugins as $key => $val ) {
if ( is_plugin_active( $key ) ) {
echo $val['Name'] . '<br/>';
}
}
echo '</pre>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment