I have the following snippet above That's all, stop editing! via wp-config.php file:

/* Enable automatic updates for WordPress ) */
define( 'WP_AUTO_UPDATE_CORE', true );

I also have the following via my functions.php file:

/**
 * Enable automatic updates for plugins and themes
 */
add_filter( 'auto_update_plugin', '__return_true' );
add_filter( 'auto_update_theme', '__return_true' );

Approximately, how frequently does WordPress check for these updates and how quickly are they automatically applied?

The websites I manage seem to vary. From the 50+ sites that I look after, half have applied plugin updates today, whilst the other half haven’t applied updates. They are all running the same code and similar setups (themes / plugins). I don’t want to jump the gun manually updating these plugins if I can establish that update times vary.

1 Answer
1

WordPress will check twice a day ( 12 hours ). This time can drift because WordPress doesn’t use traditional server cronjobs but cheap cronjobs which rely on user actions to trigger them such as viewing a page. So it could be 13 hours for when the updates are trigger but it still won’t run automatically, someone has to “trip the switch” so to speak by visiting your website.

It’s not the most reliable way but it does the job well enough. Here’s one of 3 similar functions:

/**
 * Determines whether core should be updated.
 * wp-includes/updates.php
 * Line 632 
 *
 * @since 2.8.0
 *
 * @global string $wp_version
 */
function _maybe_update_core() {
    // include an unmodified $wp_version
    include( ABSPATH . WPINC . '/version.php' );
    $current = get_site_transient( 'update_core' );
    if ( isset( $current->last_checked, $current->version_checked ) &&
            12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) &&
            $current->version_checked == $wp_version ) {
            return;
    }
    wp_version_check();
}

Leave a Reply

Your email address will not be published. Required fields are marked *