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 / Flag | Description |
|---|---|
PLUGIN... | Plugin slug(s) to activate (space-separated) |
--all | Activate all installed plugins |
--network | Activate plugin(s) network-wide on a multisite |
--quiet | Suppress 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
- Use
wp plugin install --activatewhen installing — activates immediately without a second command. - Activate plugins in dependency order — activate prerequisites before dependent plugins.
- Check status first with
wp plugin statusbefore activating to avoid errors on already-active plugins. - Use
--networkfor multisite — single-site activation only affects that site, not the entire network. - Test activation hooks on staging before mass-activating on production.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: Plugin file does not exist | Wrong slug or plugin not installed | Verify with wp plugin list |
| Plugin activates silently without running hooks | Using mu-plugins path | Activation hooks don't run for mu-plugins |
Warning: Plugin already active | Plugin was already active | Use wp plugin status to check first |
| Network activation fails | Not a multisite install | Remove --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
wp plugin deactivate— deactivate plugins.wp plugin install— install plugins.wp plugin status— check activation status.wp plugin list— list all plugins and their status.