Activating a plugin shouldn't interrupt your flow
You're editing a product and realize you need the SEO plugin on to preview the meta output. The standard flow: leave the product page, open Plugins, scroll through twenty installed plugins, find the one you want, click Activate, wait for the reload, navigate back to the product. Thirty seconds of clicking around for a one-second toggle.
What most people do instead
wp plugin activate slug. Works, but site managers rarely have terminal access.A better way: type the name, hit enter
Run activate plugin -slug=woocommerce from the navigator. The command fuzzy-matches against your installed plugin folders, resolves the one you meant, calls WordPress's native activate_plugin function. Same hooks fire as the Plugins page — every activation callback, every option write, every scheduled event registration.
Fuzzy matching, not exact-slug only. Typing -slug=woo finds WooCommerce. If multiple plugins match ("woo" matches woocommerce + woocommerce-subscriptions), the command lists all candidates so you can pick the specific one — no silent wrong-plugin activations.
How it works
The command runs WordPress's get_plugins(), lowercases each plugin folder, and matches your -slug value against it. Exact folder match wins; otherwise substring match. If exactly one plugin matches and it's not already active, activate_plugin() is called with WordPress's native activation pipeline.
/wp-content/plugins/. Partial names work.activate_plugin() call. All activation hooks run. Already-active returns a no-op.| Parameter | Value |
|---|---|
-slug(required) | Plugin folder name (fuzzy — partial names work) |
| Match strategy | Exact folder match wins, else substring. Multiple matches return an error with the list. |
| Already active | Returns status: already_active — no hooks fired twice, no error. |
| Permissions | Requires manage_options (or macro_run context) |
| Can be used in |
Real example
You're previewing a landing page draft and want to see the SEO snippet preview — but Yoast was deactivated yesterday during a performance test. You open the navigator from the draft editor and run activate plugin -slug=wordpress-seo. The plugin toggles on, all its hooks fire, the meta box appears on your next editor reload. You never left the draft, never scrolled the Plugins page, never broke your train of thought.