WordPress 3.7 was just released and one major feature that it includes is the ability have WordPress automatically updated to new versions without you having to log in and click a button.
I think it is absolutely great feature and can save you so much time in having to not log into all your site and clicking buttons, however it may not to appeal to everyone.
Reliability wise the auto update feature has been tested to death in beta and release candidates and the team working on this has ensured to cover all failure points to ensure that should something go wrong it will roll back to your previous version of WordPress. Even after 25000 auto updates in the RC releases there was not one single failure.
The WordPress team has catered for controlling auto updates via an array of filters and constants, the main constant being WP_AUTO_UPDATE_CORE. With the WP_AUTO_UPDATE_CORE constant you can control to allow disabling of auto updates, only allowing minor updates to occur automatically or allowing all updates to be done automatically.
The code below shows you how to control the automatic updates for different scenarios, you will place the code in your wp-config.php file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable Automatic Updates for all updates | |
define( 'WP_AUTO_UPDATE_CORE', true ); | |
// Disable Automatic Updates for all updates | |
define( 'WP_AUTO_UPDATE_CORE', false ); | |
// Only allow Automatic Updates for minor updates | |
define( 'WP_AUTO_UPDATE_CORE', 'minor' ); |
If you want more control of specific features such as allowing auto updates of development releases such as beta and alpha releases, or want to only enable just major or just minor updates you can do that with the use of some filters. The following code shows examples of how to control specific WordPress auto update features, this code needs to be placed in your theme’s functions.php file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Allow auto updates of development releases ie alpha, beta and RC | |
add_filter( 'allow_dev_auto_core_updates', 'wp_control_dev_auto_updates' ); | |
function wp_control_dev_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
//Allow auto updates of minor releases ie 3.7.1, 3.7.2 | |
add_filter( 'allow_minor_auto_core_updates', 'wp_control_minor_auto_updates' ); | |
function wp_control_minor_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
//Allow auto updates of major releases ie 3.7, 3.8, 3.9 | |
add_filter( 'allow_major_auto_core_updates', 'wp_control_major_auto_updates' ); | |
function wp_control_major_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
// Allow auto theme updates | |
add_filter( 'auto_update_theme', 'wp_control_theme_auto_updates' ); | |
function function wp_control_theme_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
// Allow auto plugin updates | |
add_filter( 'auto_update_plugin', 'wp_control_plugin_auto_updates' ); | |
function function wp_control_plugin_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
// Allow auto language updates | |
add_filter( 'auto_update_translation', 'wp_control_translation_auto_updates' ); | |
function function wp_control_translation_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} |
If you have any questions or suggestions please feel free to leave them in the comments.
Hey Gerhard, you can use __return_true() __return_false() instead, that saves some lines of code! For example:
add_filter (‘allow_dev_auto_core_updates’, ‘__return_true’);
Thanks Remi, will look into updating the gists when I get some time 🙂
On the site that loads after update to 3.7 with list of biggest changes, there is an information at the bottom that you can enable auto-update only for specific plugins, not all of them. Do you know how to do it and could add this to your post?
0 Pingbacks