• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Show a list of active plugins in a WordPress installation

Discover in this tutorial how to get and display all the active plugins of a WordPress installation using code.

It is possible that in some cases you may want to show (or get) all the plugins of a WordPress installation, including version, author and other data.

So in this tutorial you are going to learn how you can get a list of all active plugins of a WordPress installation. This would be the result:

List of active plugins of a WordPress installation
List of active plugins of a WordPress installation

Let’s see it:

Steps to display all active plugins of a WordPress installation using a shortcode

1. Create the shortcode

First you are going to encapsulate the active plugins inside a shortcode to be able to display the list wherever you want.

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 847 code snippets of this website, login or subscribe here.

With this code you create a shortcode that allows you to display a list of all active plugins in the WordPress installation using the [plugin_list] shortcode.

To get the list of plugins you use the get_plugins() function together with a foreach loop.

In this case, 3 details of plugin information are displayed:

  • Plugin name [Name] > with link to it [PluginURI]
  • Plugin version [Version]> with link to it [PluginURI]
  • Author’s name [Author] > with link to it [AuthorURI]

But you can remove or add more to customize it to your liking. These are all the details you can display:

  • [Name]
  • [PluginURI]
  • [Version]
  • [Description]
  • [Author]
  • [AuthorURI]
  • [TextDomain]
  • [DomainPath]
  • [Network]
  • [RequiresWP]
  • [RequiresPHP]
  • [UpdateURI]
  • [Title]

For example, for the Osom Blocks plugin, it returns something like this:

[Name] => Osom Blocks 
[PluginURI] => https://osompress.com 
[Version] => 1.2 
[Description] => Gutenberg Block collection for OsomPress themes 
[Author] => OsomPress 
[AuthorURI] => https://twitter.com/osompress 
[TextDomain] => osomblocks 
[DomainPath] => /languages 
[Network] => 
[RequiresWP] => 
[RequiresPHP] => 
[UpdateURI] => 
[Title] => Osom Blocks 
[AuthorName] => OsomPress

So you can customize the details you prefer to be displayed.

You can also get all plugins to be shown, not just the active ones, by removing the if ( is_plugin_active( $plugin ) ) conditional.

If you have any questions or suggestions you can leave them in the comments.

To be able to see the list there is only one step left.

2. Insert the shortcode where you want

The advantage of shortcodes is that you can insert them anywhere on the web.

You only have to type [plugin_list] where you want it to be displayed.

Important:

  • If you are using the classic editor, use the HTML tab to enter the shortcode.
  • In case you are already using the new block editor (Gutenberg) you can add it to the normal paragraph block, the HTML block or the shortcode block. All of them will render the content correctly.

This would be an example of the listing that the shortcode would display:

List of active plugins of a WordPress installation
List of active plugins in a WordPress installation

Conclusions

Now you know how to get and display all the active plugins of a WordPress installation to decide if you need them all or not.

Any questions? I read you in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

PHP Plugins Shortcode WordPress

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?