maintenance_nag

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

WordPress Version: 6.4

/**
 * Displays maintenance nag HTML message.
 *
 * @since 2.7.0
 *
 * @global int $upgrading
 *
 * @return void|false
 */
function maintenance_nag()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    wp_admin_notice($msg, array('type' => 'warning', 'additional_classes' => array('update-nag', 'inline'), 'paragraph_wrap' => false));
}

WordPress Version: 6.3

/**
 * Displays maintenance nag HTML message.
 *
 * @since 2.7.0
 *
 * @global int $upgrading
 *
 * @return void|false
 */
function maintenance_nag()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 6.1

/**
 * Displays maintenance nag HTML message.
 *
 * @since 2.7.0
 *
 * @global int $upgrading
 * @return void|false
 */
function maintenance_nag()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 5.5

/**
 * @since 2.7.0
 *
 * @global int $upgrading
 * @return void|false
 */
function maintenance_nag()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 5.4

/**
 * @since 2.7.0
 *
 * @global int $upgrading
 * @return void|false
 */
function maintenance_nag()
{
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 5.3

/**
 * @global int $upgrading
 * @return false|void
 */
function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: %s: URL to WordPress Updates screen. */
            __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'),
            'update-core.php'
        );
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 5.1

/**
 * @global int $upgrading
 * @return false|void
 */
function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.9

/**
 *
 * @global int $upgrading
 * @return false|void
 */
function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the installation claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.3

/**
 *
 * @global int $upgrading
 * @return false|void
 */
function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the install claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: .10

function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the install claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (version_compare($failed['attempted'], $wp_version, $comparison)) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 3.7

function maintenance_nag()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    global $upgrading;
    $nag = isset($upgrading);
    if (!$nag) {
        $failed = get_site_option('auto_core_update_failed');
        /*
         * If an update failed critically, we may have copied over version.php but not other files.
         * In that case, if the install claims we're running the version we attempted, nag.
         * This is serious enough to err on the side of nagging.
         *
         * If we simply failed to update before we tried to copy any files, then assume things are
         * OK if they are now running the latest.
         *
         * This flag is cleared whenever a successful update occurs using Core_Upgrader.
         */
        $comparison = (!empty($failed['critical'])) ? '>=' : '>';
        if (version_compare($failed['attempted'], $wp_version, '>=')) {
            $nag = true;
        }
    }
    if (!$nag) {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
    } else {
        $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
    }
    echo "<div class='update-nag'>{$msg}</div>";
}