Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress - list all plugins in text via shortcode
<?php
/**
* List off all plugins used via `[list_plugins]` shortcode.
*
* Note that this includes inactive plugins, so keep the plugins tidy.
*
* @return string of html, list of plufins and links to their site.
*/
add_shortcode('list_plugins', function(){
$list_plugins = [];
$plugins = get_plugins();
foreach ( $plugins as $plugin ) {
if ( in_array( $plugin['Name'], [ 'Gutenberg', 'Classic Editor' ] ) ) {
continue;
}
$list_plugins[] = "<a href='".esc_url( $plugin['PluginURI'] )."'>".esc_html( $plugin['Name'] )."</a>";
}
return implode( ', ', $list_plugins );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.