Skip to main content

wp plugin activate

Overview

Activate one or more WordPress plugins instantly from the terminal. Activate a single plugin, a list, or all installed plugins at once — with no wp-admin required.

What It Does

wp plugin activate triggers WordPress's plugin activation routine for the specified plugin(s) — the same action as clicking "Activate" in the dashboard. Activation hooks run as expected, making it safe for plugins that initialize database tables or settings on activation.

Syntax

wp plugin activate <plugin>... [--all] [--network] [--quiet]

Arguments & Options

Argument / FlagDescription
PLUGIN...Plugin slug(s) to activate (space-separated)
--allActivate all installed plugins
--networkActivate plugin(s) network-wide on a multisite
--quietSuppress output

Basic Usage

Activate a single plugin

wp plugin activate woocommerce

Output:

Plugin 'woocommerce' activated.
Success: Activated 1 of 1 plugins.

Activate multiple plugins

wp plugin activate contact-form-7 yoast-seo litespeed-cache

Activate all installed plugins

wp plugin activate --all

Activate network-wide (multisite)

wp plugin activate woocommerce --network

Real-World Scenarios

Scenario 1: Post-install activation in a setup script

# Install and activate in one flow
wp plugin install woocommerce --activate
wp plugin install contact-form-7 --activate
wp plugin install litespeed-cache --activate

Scenario 2: Activate a set of required plugins after fresh install

#!/bin/bash
REQUIRED_PLUGINS=(
"woocommerce"
"yoast-seo"
"contact-form-7"
"litespeed-cache"
"acf"
)

for plugin in "${REQUIRED_PLUGINS[@]}"; do
if wp plugin is-installed "${plugin}"; then
wp plugin activate "${plugin}"
else
echo "Plugin not installed: ${plugin}"
fi
done

Scenario 3: Activate a mu-plugin equivalent via CLI

wp plugin activate my-custom-plugin --network

Scenario 4: Conditional activation (only if inactive)

STATUS=$(wp plugin status woocommerce --format=json | python3 -c "import sys,json; print(json.load(sys.stdin)['status'])")
if [ "${STATUS}" != "active" ]; then
wp plugin activate woocommerce
fi

Best Practices

  1. Use wp plugin install --activate when installing — activates immediately without a second command.
  2. Activate plugins in dependency order — activate prerequisites before dependent plugins.
  3. Check status first with wp plugin status before activating to avoid errors on already-active plugins.
  4. Use --network for multisite — single-site activation only affects that site, not the entire network.
  5. Test activation hooks on staging before mass-activating on production.

Troubleshooting

ProblemCauseFix
Error: Plugin file does not existWrong slug or plugin not installedVerify with wp plugin list
Plugin activates silently without running hooksUsing mu-plugins pathActivation hooks don't run for mu-plugins
Warning: Plugin already activePlugin was already activeUse wp plugin status to check first
Network activation failsNot a multisite installRemove --network flag

Quick Reference

wp plugin activate woocommerce                   # Activate single
wp plugin activate plugin-a plugin-b # Activate multiple
wp plugin activate --all # Activate all
wp plugin activate woocommerce --network # Network-wide
wp plugin list --status=inactive # See inactive plugins

Next Steps