Enable Auto-updates for all plugins using wp-cli? (since wordpress 5.5)

The simplest way via wp-cli that comes to mind (while it’s not supported yet as far as I can see) is something like:

wp eval "update_option( 'auto_update_plugins', array_keys( get_plugins() ) );"

that will update the auto_update_plugins option with the array of all plugin files to update.

This should probably be extended further to only update plugins that are truly updateable or e.g. from a json list to use the json format option of wp-cli.

One can also enable all plugin updates with a filter in a plugin:

add_filter( 'auto_update_plugin', '__return_true' );

That will show up as “Auto-updates enabled” for each plugin in the plugins admin table but the user will not be able to change it from the UI.

ps: this wp-cli command suggestion by Jeffrey Paul seems very useful.

Update: This seems to be supported in wp-cli/extension-command version 2.0.12 by this pull request:

wp plugin auto-updates status [<plugin>...] [--all] [--enabled-only] [--disabled-only] [--field=<field>]
wp plugin auto-updates enable [<plugin>...] [--all] [--disabled-only]
wp plugin auto-updates disable [<plugin>...] [--all] [--enabled-only]

but it looks like it’s not merged into the main wp-cli yet in version 2.4.

It’s possible to get the latest version with:

wp package install [email protected]:wp-cli/extension-command.git

according to the installing part of the wp-cli/extension-command docs.

Leave a Comment