Home Blog Display Active WordPress Plugins in a Post or Page with Shortcode

Display Active WordPress Plugins in a Post or Page with Shortcode


While I don’t know exactly why you would want to display your active WordPress plugins for the world to see, there may come a time where it’s necessary. The WordPress shortcode function on this page will do just that: render all your active plugins in a list (with optional link back to the plugin page). We’ll provide a few different ways of accomplishing the same thing.

The Result

The shortcode of [showplugins] returns the following list:

  • akismet
  • crayon-syntax-highlighter
  • hiztory
  • beliefmedia
  • beliefmedia-examples
  • lipsum
  • metar
  • shortt
  • simple-audio-player
  • simple-post-counter
  • wp-super-cache

In our case, there’s 11 plugins. However, three of those are ours and aren’t hosted with WordPress. The plugin beliefmedia-examples, for example, is a plugin we use just to host example code that isn’t part of our own site core. The next function addresses this in a couple of different ways.

WP Shortcode Functions

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.


The first function makes use of get_option to retrieve the plugin array.


Rather than use get_option, you may choose to use wp_get_active_and_valid_plugins() . Rather than return just the directory/filename.php, it returns the full path in its array. The function, located in wp-includes/load.php , will first do what we did above – use get_option to return an array – but then it continues to check the validity of the file and ensures it’s not a default network plugin. Interestingly, it first checks for the old hackfile.php (I’m surprised WP still include it).

The shortcode of [showactivevalid] will return the same list as above.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Linking back to Plugins on WordPress.org

Sometimes you might want to link the plugin back to WordPress.org. However, WordPress doesn’t discriminate against plugins installed from their own library or something you’ve written yourself, or something you’ve downloaded from elsewhere. So, to circumvent this we can create an $exclude array that’ll give us a crude means of checking whether the plugin link should be created or just returned by name.

The result is as follows:


  • While there’s not much use to this code, we use it to query client websites (via an API built into a company plugin) that returns plugin data so it can be surveyed at times when a security exploit is identified. We also use it to simply tally the number of plugins they have installed.


Title: Display Active WordPress Plugins
Description: Display Active WordPress Plugins in a Post or Page with Shortcode
Download: Shortcode (V0.2) | WP Plugin (V0.2) | | Plugin Page

Shortt URL for this post: http://shor.tt/1XNx


Please enter your comment!
Please enter your name here