Create a list of all active plugins

The first thing you will learn about plugins in WordPress is how to install them. After the installation process which is almost always quick and simple, you will learn the difference between active and inactive plugins.

Usually, when you install something, it becomes active on the system right after the installation process is over. That’s the case with your operating system on a computer or you see the same if you install an app on your smartphone. But WordPress has a different approach. Even after you install the plugin, you will only have its files uploaded to the server, but the files and code stored in them won’t be executed until you click on the activate button.

Because only active plugins can actually make an impact on your website, sooner or later you will need to find which plugins are active. While you can do that easily by browsing through plugins page, sometimes it will be faster and more efficient if you make a list of active plugins.

You can create that list for development purposes or you can take advantage of it if you’re trying to debug a site for a client who has gathered over a dozen of active plugins. Or you may want to show the list to your visitors so that they can know which plugins you are currently running on the site.

Without prolonging the story about active plugins, let’s see how to create a list so that you can give it a try.

Show all active plugins:

  1. Open sidebar.php (or any file where you want to show the list) or see how to put the code in the Text Widget
  2. Copy and paste the code:
  3. function active_plugins() {
    $the_plugs = get_option('active_plugins');
    foreach($the_plugs as $key => $value) {
    $string = explode('/',$value); // Folder name will be displayed
    echo $string[0] ."\n";
    }
    }
    active_plugins();
    
  4. Save changes

After you have entered the code, WordPress will be ready to find all the active plugins on your site and list them where you want them. Much easier than browsing through the list by yourself and changing the list every time you change a plugin or two, wasn’t it?

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *