find_core_auto_update

The timeline below displays how wordpress function find_core_auto_update has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Gets the best available (and enabled) Auto-Update for WordPress core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the installation allows it, else, 1.2.3.
 *
 * @since 3.7.0
 *
 * @return object|false The core update offering on success, false on failure.
 */
function find_core_auto_update()
{
    $updates = get_site_transient('update_core');
    if (!$updates || empty($updates->updates)) {
        return false;
    }
    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    $auto_update = false;
    $upgrader = new WP_Automatic_Updater();
    foreach ($updates->updates as $update) {
        if ('autoupdate' !== $update->response) {
            continue;
        }
        if (!$upgrader->should_update('core', $update, ABSPATH)) {
            continue;
        }
        if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) {
            $auto_update = $update;
        }
    }
    return $auto_update;
}

WordPress Version: 5.4

/**
 * Gets the best available (and enabled) Auto-Update for WordPress core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the installation allows it, else, 1.2.3.
 *
 * @since 3.7.0
 *
 * @return object|false The core update offering on success, false on failure.
 */
function find_core_auto_update()
{
    $updates = get_site_transient('update_core');
    if (!$updates || empty($updates->updates)) {
        return false;
    }
    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    $auto_update = false;
    $upgrader = new WP_Automatic_Updater();
    foreach ($updates->updates as $update) {
        if ('autoupdate' != $update->response) {
            continue;
        }
        if (!$upgrader->should_update('core', $update, ABSPATH)) {
            continue;
        }
        if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) {
            $auto_update = $update;
        }
    }
    return $auto_update;
}

WordPress Version: 4.9

/**
 * Gets the best available (and enabled) Auto-Update for WordPress Core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the installation allows it, else, 1.2.3
 *
 * @since 3.7.0
 *
 * @return array|false False on failure, otherwise the core update offering.
 */
function find_core_auto_update()
{
    $updates = get_site_transient('update_core');
    if (!$updates || empty($updates->updates)) {
        return false;
    }
    include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    $auto_update = false;
    $upgrader = new WP_Automatic_Updater();
    foreach ($updates->updates as $update) {
        if ('autoupdate' != $update->response) {
            continue;
        }
        if (!$upgrader->should_update('core', $update, ABSPATH)) {
            continue;
        }
        if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) {
            $auto_update = $update;
        }
    }
    return $auto_update;
}

WordPress Version: 4.3

/**
 * Gets the best available (and enabled) Auto-Update for WordPress Core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the install allows it, else, 1.2.3
 *
 * @since 3.7.0
 *
 * @return array|false False on failure, otherwise the core update offering.
 */
function find_core_auto_update()
{
    $updates = get_site_transient('update_core');
    if (!$updates || empty($updates->updates)) {
        return false;
    }
    include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    $auto_update = false;
    $upgrader = new WP_Automatic_Updater();
    foreach ($updates->updates as $update) {
        if ('autoupdate' != $update->response) {
            continue;
        }
        if (!$upgrader->should_update('core', $update, ABSPATH)) {
            continue;
        }
        if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) {
            $auto_update = $update;
        }
    }
    return $auto_update;
}

WordPress Version: 3.7

/**
 * Gets the best available (and enabled) Auto-Update for WordPress Core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the install allows it, else, 1.2.3
 *
 * @since 3.7.0
 *
 * @return bool|array False on failure, otherwise the core update offering.
 */
function find_core_auto_update()
{
    $updates = get_site_transient('update_core');
    if (!$updates || empty($updates->updates)) {
        return false;
    }
    include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    $auto_update = false;
    $upgrader = new WP_Automatic_Updater();
    foreach ($updates->updates as $update) {
        if ('autoupdate' != $update->response) {
            continue;
        }
        if (!$upgrader->should_update('core', $update, ABSPATH)) {
            continue;
        }
        if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) {
            $auto_update = $update;
        }
    }
    return $auto_update;
}