Restrict plugin (or all) autoupdates to business hours – WordPress

We love the plugin autoupdate functionality in WordPress, but we really don’t want them to update on a Saturday night, potentially bringing a site down and messing up our weekend.

Update
I’ve made this into a downloadable plugin here: https://github.com/a8cteam51/plugin-autoupdate-filter/

When do plugin autoupdates happen?

Every time someone hits admin: add_action( 'admin_init', '_maybe_update_plugins' );

This function checks if plugin autoupdates have happened in the last 12 hours: https://core.trac.wordpress.org/browser/tags/5.5.3/src/wp-includes/update.php#L804

So it’s not a specific time, but rather it’s checking a transient to see when it last happened. It’s also not reliant on WP_CRON.

This is good news, because we don’t have to worry about hitting a 12 hour window – it will just check if it’s happened in the last 12 hours and then run if it’s in a predefined window we set.

How do we set time windows for updates?

Method 1: All Autoupdates

Method 2: Plugins Only

Note that this second method respects the autoupdate setting within business hours, so you can still fully disable autoupdates for specific plugins individually.