Disable Auto Updates In WordPress
In the past when there is a new WordPress version release the site admin would have to log into the admin area and manually update their website.
As of WordPress 3.7 the core development team have created a new feature called automatic updates.
This is done by using the new WP_Automatic_Updater class located in /wp-admin/includes/class-wp-updater.php.
This is not just for core updates it can also be used to automatically update themes and plugins. With this new class there are lots of information in the codex to use the auto updater class.
In the state of the word presentation in 2012 Matt Mullenweg made it clear that he wanted to introduce a feature for auto updates into WordPress.
Ever since seeing how useful the auto updates were in other software projects such as Chrome. This will automatically update the software in the background without telling the user that an update has taken place, if all goes well the user shouldn't even know that an update was happening. Since then WordPress have been working towards this vision and have done so with the WP_Automatic_Updater class.
But not all developers think that this is a good idea, as one day their website will work perfectly fine and without them knowing a WordPress update could break their site. This feature by default is only turned on for minor releases and security updates, so it should be a good thing for all WordPress sites to leave on. If this was around when the timthunb security hole was found all WordPress sites would of been fixed overnight.
Because some developers have said they would want to turn this off so WordPress has built in a way to opt-out of future automatic updates.
There is no where in the admin area to turn off the automatic updates, you need to add some code into your application, there are different levels of updates and these come with there own constant variables or filters to change the automatic updates.
To completely turn off all automatic updates you can add a new constant variable in your wp-config.php file.
define( 'AUTOMATIC_UPDATER_DISABLED', true ); // WordPress filter to disable updates add_filter( 'automatic_updater_disabled', '__return_true' );
Types Of Releases
With WordPress there are 3 types of releases and you can change any of these by adding code into your wp-config.php file.
- Core code updates
- Minor core updates, maintenance and security
- Major core code
By default WordPress will only update for minor core updates, but this can be changed by adding a new constant variable to your wp-config.php file.
// Auto update all 3 types of releases define('WP_AUTO_UPDATE_CORE', true); // Disable all 3 types of releases define('WP_AUTO_UPDATE_CORE', false); // Only auto update minor changes define('WP_AUTO_UPDATE_CORE', 'minor');
The auto update feature has come with a number of new filters you can use to configure the auto update.
To use these filter you need to return a boolean value depending if you want the update, best done with the __return_true and __return_false callback functions.
allow_dev_auto_core_updates will allow you to get the nightly WordPress Dev updates automatically (should not be used on your live site).
add_filter( 'allow_dev_auto_core_updates', '__return_true' );
If you want to turn off just all minor updates then you will use the filter allow_minor_auto_core_updates and return false, remember this is set to true by default.
add_filter( 'allow_minor_auto_core_updates', '__return_false' );
If you want to just turn on auto update for the any major core updates use the filter allow_major_auto_core_updates.
add_filter( 'allow_major_auto_core_updates', '__return_true' );
Plugin And Theme Updates
If you are using a plugin or theme that is hosted on the WordPress repository then can turn on auto updates for these files. This is turned off by default but you can use 2 new filters to turn this on for plugins or themes.
add_filter( 'auto_update_plugin', '__return_true' ); add_filter( 'auto_update_theme', '__return_true' );
Find out more about disabling WordPress auto update in this post on the WordPress blog.
Subscribe To Newsletter
Get weekly updates to your email