Skip to main content

Plugin

Vasyl MartyniukLess than 1 minute

Syntax

Plugin
Plugin:<plugin-slug>

If no plugin-slugprovided, all plugins are assumed.

Definition

AAM treats each plugin as a separate resource that is identified by the unique plugin’s slug. The easier way to find the correct plugin’s slug is to go to the wp-content/plugins folder and the name of the plugin’s folder is the slug.

The other way is to go to the Plugins page and hover on the desired plugin. The URL will contain the query parameter with the plugin’s slug as shown in the screenshot below.

AAM Plugin Slug

The Plugin resource supports several actions as follows.

  • WP:list. Ability to remove/hide the specific plugin from the list of plugins.
  • WP:activate. Ability to activate specific plugins.
  • WP:deactivate. Ability to deactivate specific plugins;
  • WP:delete. Ability to delete any plugin. Extends the default WordPress core capability delete_pluginsopen in new window
  • WP:install. Ability to install any plugin. Extends the default WordPress core capability install_pluginsopen in new window.
  • WP:update. Ability to update any plugin. Extends the default WordPress core capability update_pluginsopen in new window.
  • WP:edit. Ability to edit any plugin. Extends the default WordPress core capability edit_pluginsopen in new window.

In the example below we hide and restrict the ability to deactivate the AAM plugin.

{
    "Statement": [
        {
            "Effect": "deny",
            "Resource": [
                "Plugin:advanced-access-manager"
            ],
            "Action": [
                "WP:list",
                "WP:deactivate"
            ]
        }
    ]
}

The following statement restricts the ability to update or deactivate all the plugins.

{
    "Statement": [
        {
            "Effect": "deny",
            "Resource": "Plugin",
            "Action": [
                "WP:update",
                "WP:deactivate"
            ]
        }
    ]
}