Hi,
this very handy and extremely simple PHP Snippet creates a alphabetical list of all installed Plugins and their versions.
To use, simply add [list_plugins] on any page, once you have enabled the following Code Snippet. Add it to your functions.php, or through a plugin like Code Snippets.
Please disable this snippet once you have done the things you needed to do with your list, as this might impose a security thread in the wrong hands.

function list_plugins_shortcode() {
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
$output = '<table style="width: 100%; border-collapse: collapse;">
<tr style="background-color: #f2f2f2;">
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Plugin Name</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Version</th>
</tr>';
foreach ($all_plugins as $plugin_path => $plugin_data) {
$output .= '<tr>
<td style="border: 1px solid #ddd; padding: 8px;">' . esc_html($plugin_data['Name']) . '</td>
<td style="border: 1px solid #ddd; padding: 8px;">' . esc_html($plugin_data['Version']) . '</td>
</tr>';
}
$output .= '</table>';
return $output;
}
add_shortcode('list_plugins', 'list_plugins_shortcode');
Leave a Reply