As the title suggests, I was wondering how to check if a certain plugin exists (and has been installed).

And secondly, check that the plugin is actually enabled.

  • Can you elaborate? Do you need to check from somewhere else other than the "/admin/settings/plugins" screen?
    – Rick
    Commented Jul 20, 2015 at 23:14

4 Answers 4


On top of checking within the admin area, there are some other ways you can do this, both in templates and in your plugins.

In a template

{# Second argument is if you want enabled only #}
{% set plugin = craft.plugins.getPlugin('pluginHandle', false) %}

{# Now you have access to these methods... #}
{{ plugin.isEnabled() }}
{{ plugin.isInstalled() }}

For a full list of methods, see PluginVariable in craft docs.

For more info on how to get plugins within your templates, see the PluginsVariable, note this is different from PluginVariable.

In your plugin

To check a plugin from within your own plugin:

// Again, second arg is if you just want enabled plugins
$plugin = craft()->plugins->getPlugin('pluginHandle', false);

// Then you can do things like:

See the PluginService and also the BasePlugin for more info.

Hope that helps :)

  • 1
    Thanks Alec, this is exactly what I was after. To elaborate on my purpose for this: My plugin relies on the basis that certain fieldtypes are created first. I could check for the fieldtype itself, but I found myself doing a lot of long winded (is defined and is not null and *fieldtype*|length) checks that was making the code look untidy. A simple check to see if the plugin is active in the first place allow me to create more informative conditions. Now I can tell the user "This page isn't working because..." as apposed to an immediate error page as soon as the plugin is installed. Commented Jul 22, 2015 at 11:34
  • No worries! and if your plugin is relying on certain fieldtypes being created, are these something you could create within the onAfterInstall method on the plugin? that way you can always be sure the fieldtypes will be there and will also minimise user error, fieldtype handle mismatches and so forth. Commented Jul 22, 2015 at 13:52
  • Am I right in thinking that pluginHandle corresponds to the directory name of the plugin? Couldn't find any documentation on this, but after a bit of trial and error that's what worked for me.
    – Nick F
    Commented Oct 12, 2015 at 15:11
  • For craft cms 3 see me answer.
    – inrsaurabh
    Commented May 15, 2019 at 7:42

For craft cms 3

{% set plugin = craft.app.plugins.getPlugin('plugin-handle', false) %}

{% if plugin is not null and plugin.isInstalled %}
    call plugin related stuff here
{% endif %}

To check plugin handle.

  1. Open composer.json of your plugin.
  2. Search for handle param in that file, that's the plugin handle.

A simple way to check that a plugin is both installed and enabled is to use Twig's is defined test (since craft.pluginHandle is defined only if the plugin is both installed and enabled):

{% if craft.pluginHandle is defined %}
{% endif %}

(Credit due to this answer)


It should show up in the control panel in the plugins section. It will show the name of the plugin and if it is enabled. I've had issues when i didn't setup the folder correctly. Double check the plugin documentation, it should tell you what folder to place within the craft plugins directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.