Check if a specific plugin is active on WordPress website

No matter how much you might try not to use any WordPress plugins, this platform is renowned for its extensions. Yes, there are many times when a feature can be introduced by adding a snippet on the right spot in one of the core files, but there are plugins so powerful that not many will be able to replace them by their own code.

If you’re developing your own theme or modifying an existing one, sometimes it will be a smart move to check if a specific plugin is active on the site.  When there are so many different plugins, it is practically impossible to avoid collisions. One plugin will override styles you’re using, the other will take over a feature or two while some will render your theme/plugin dysfunctional. That’s why you will need to check for some plugins and take specific actions if a plugin is active or not.

On the other hand, you might only want to show a list of active plugins or tell people when a certain plugin is active on your site.

Whatever the reason lead you to this article, we are about to show you how to check if a specific plugin is active on a WordPress website.

Luckily, WordPress developers, like always, were thinking about end users and that’s why this task gets as easy as possible. To check for active plugins, you will need only one simple condition rule.

Check if a specific plugin is active:

if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
// if the statement is true, do something
}

All you will have to do here is to change the plugin directory and plugin file name in order to check for that specific extension. If you run the check, the function will return “true” statement if the plugin is active or “false” one if it isn’t. After that, you can do practically anything with the result to make your theme/plugin better.

Show the status of a plugin to your visitors:

While this is enough to be used in admin pages, if you’re planning on checking if a plugin is active on the frontend, i.e. show it to your visitors, you will need to include additional file before the previously mentioned condition rule:

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

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 *