Enable Auto-updates for all plugins using WP-CLI

When it comes to managing site updates it can be painstaking, especially when you have more sites than you can count on one, or even two hands. Even with that being said I know the sites that I manage pretty well from inside and out, so I am fine with automating updates.

Most of the sites are very lean and are running the same plugins from reputable sources such as GeneratePress, WP-Rocket, or Gravity Forms to name a few. I am very confident that when they push an update it is not going to end up breaking my site.

Rather than spend time logging into each site and enabling automatic updates on plugins I was looking for was a way to script it out and as suspected you can enable automatic updates with WP-CLI. I am not going to share my entire bash script as it more or less runs through all of the sites hosted on my platform and performs the following command to enable automatic updates of all installed plugins.

wp plugin auto-updates enable --all --skip-themes --skip-plugins

It is now nice knowing that I don’t have to login and manually push updates from the WordPress Dashboard or via my previous manual bash script that I would run weekly.

*It is also good to note that WP-CLI does not play nice yet with PHP 8.0 so I run the previous command with PHP 7.4 instead to prevent errors.