Search code examples
wordpressconfigurationautomatic-updates

Configure Automatic Updates in WordPress - Where to place code


I'm trying to configure automatic updates for Wordpress for some days now. But i can't find a good manual or example online.

To make all updates happen, i have added the code below to my wp-config.php after "require_once(ABSPATH . 'wp-settings.php’);" , but what did i do wrong?

/** **** END OF wp-config.php file ****** */
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

/** AUTO UPDATE */
define( 'WP_AUTO_UPDATE_CORE', true );

/** update filters specifically *//
add_filter( 'allow_dev_auto_core_updates', '__return_false' );
add_filter( 'allow_minor_auto_core_updates', '__return_true' );
add_filter( 'allow_major_auto_core_updates', '__return_true' );
add_filter( 'auto_update_plugin', '__return_true' );
add_filter( 'auto_update_theme', '__return_true' );
add_filter( 'auto_update_translation', '__return_true' );

I'm using the last Wordpress version 3.9.1 right now after updating manually.


Solution

  • What you have done is correct.

    The filters should be added in wp-config file itself. You can confirm this here

    It is just that you have to wait for auto-update to work.

    Actually, the automatic update is pushed from wp.org.

    When a new minor update is released, the guys at WordPress start to roll out the update. The actual update process is started by a request from wp.org to your site!

    As every site checks with wp.org for new versions (usually twice dayily using wp-cron), the rolloutserver knows how many sites need an update.

    Then the rollout begins, starting slowly - 1 out of 128 sites gets updated automatically. This is being monitored, and if the successrate indicates no problems with the rollout, more of the sites get the automatic update (usually the next step would be 1 out of 64, and continuing to increase that way) until all automatic updates are delivered.

    This enables the developers to stop the rollout if any problems occur.

    The sites selected by the 1 out of 128 is actually random. Well, not really, but if you want to know, it works like this:

    The Url of the site needing an update gets hashed using MD5. Using just the first three characters of this hash and converting it to base10, this results in 4096 possibilities. The update started for sites having a calculated number between 0 and 31 (4096 / 32 = 128).

    So its quite Random.

    More details about this process is given here

    Also the process has been defined in detail in an artcle on on wordpress.org.

    I hope this helps :)