How do I activate an mu-plugin with WP-CLI?

Do I need some extra WP-CLI bundle to activate mu-plugins via command line? I can’t find anything about that in the docs. Are mu-plugins treated differently by WP-CLI?

I created /wp-content/mu-plugins/my-plugin.php containing:

<?php
/*
  Plugin Name: My Plugin
  Description: Provide must-use code.
  Version: 1.0
*/

When I do:

$ wp plugin list

I get:

+---------------+----------+--------+---------+
| name          | status   | update | version |
+---------------+----------+--------+---------+
| akismet       | inactive | none   | 4.0.8   |
| hello         | active   | none   | 1.7     |
| my-plugin     | must-use | none   | 1.0     |
+---------------+----------+--------+---------+

But when I do:

$ wp plugin activate my-plugin

I get:

Warning: The 'my-plugin' plugin could not be found.
Error: No plugins activated.

1
1

mu-plugins don’t get activated. They’re activated just by being in that folder.

Leave a Comment