update_nag

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

WordPress Version: 4.1

/**
 * Returns core update notification message.
 *
 * @since 2.3.0
 *
 * @global string $pagenow The filename of the current screen.
 * @return void|false
 */
function update_nag()
{
    global $pagenow;
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    if ('update-core.php' === $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/documentation/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    wp_admin_notice($msg, array('type' => 'warning', 'additional_classes' => array('update-nag', 'inline'), 'paragraph_wrap' => false));
}

WordPress Version: 6.4

/**
 * Returns core update notification message.
 *
 * @since 2.3.0
 *
 * @global string $pagenow The filename of the current screen.
 * @return void|false
 */
function update_nag()
{
    global $pagenow;
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    if ('update-core.php' === $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/documentation/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    wp_admin_notice($msg, array('type' => 'warning', 'additonal_classes' => array('update-nag', 'inline'), 'paragraph_wrap' => false));
}

WordPress Version: 6.3

/**
 * Returns core update notification message.
 *
 * @since 2.3.0
 *
 * @global string $pagenow The filename of the current screen.
 * @return void|false
 */
function update_nag()
{
    global $pagenow;
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    if ('update-core.php' === $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/documentation/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 6.1

/**
 * Returns core update notification message.
 *
 * @since 2.3.0
 *
 * @global string $pagenow The filename of the current screen.
 * @return void|false
 */
function update_nag()
{
    global $pagenow;
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    if ('update-core.php' === $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 5.5

/**
 * @since 2.3.0
 *
 * @global string $pagenow
 * @return void|false
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' === $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag notice notice-warning inline'>{$msg}</div>";
}

WordPress Version: 5.4

/**
 * @since 2.3.0
 *
 * @global string $pagenow
 * @return void|false
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || 'upgrade' !== $cur->response) {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 5.3

/**
 * @global string $pagenow
 * @return false|void
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 5.1

/**
 * @global string $pagenow
 * @return false|void
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    $version_url = sprintf(
        /* translators: %s: WordPress version */
        esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')),
        sanitize_title($cur->current)
    );
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: new WordPress version, 3: URL to network admin, 4: accessibility text */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            $version_url,
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: new WordPress version */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.6

/**
 *
 * @global string $pagenow
 * @return false|void
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(
            /* translators: 1: Codex URL to release notes, 2: new WordPress version, 3: URL to network admin, 4: accessibility text */
            __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'),
            sprintf(
                /* translators: %s: WordPress version */
                esc_url(__('https://codex.wordpress.org/Version_%s')),
                $cur->current
            ),
            $cur->current,
            network_admin_url('update-core.php'),
            esc_attr__('Please update WordPress now')
        );
    } else {
        $msg = sprintf(
            /* translators: 1: Codex URL to release notes, 2: new WordPress version */
            __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'),
            sprintf(
                /* translators: %s: WordPress version */
                esc_url(__('https://codex.wordpress.org/Version_%s')),
                $cur->current
            ),
            $cur->current
        );
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.5

/**
 *
 * @global string $pagenow
 * @return false|void
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s" aria-label="Please update WordPress now">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.3

/**
 *
 * @global string $pagenow
 * @return false|void
 */
function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 4.2

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: 0.4

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: .38

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
        $msg_line2 = sprintf(
            /* translators: 1: WordPress version number, 2: Link to update WordPress */
            __('Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.'),
            get_bloginfo('version', 'display'),
            network_admin_url('update-core.php')
        );
    } else {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
        $msg_line2 = sprintf(
            /* translators: 1: WordPress version number, 2: Link to update WordPress */
            __('Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.'),
            get_bloginfo('version', 'display'),
            __('https://wordpress.org/download/')
        );
    }
    echo "<div class='update-nag update-nag-core-insecure'><p>{$msg}</p><p>{$msg_line2}</p></div>";
}

WordPress Version: 7.5

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}

WordPress Version: .41

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
        $msg_line2 = sprintf(
            /* translators: 1: WordPress version number, 2: Link to update WordPress */
            __('Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.'),
            get_bloginfo('version', 'display'),
            network_admin_url('update-core.php')
        );
    } else {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
        $msg_line2 = sprintf(
            /* translators: 1: WordPress version number, 2: Link to update WordPress */
            __('Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.'),
            get_bloginfo('version', 'display'),
            __('https://wordpress.org/download/')
        );
    }
    echo "<div class='update-nag update-nag-core-insecure'><p>{$msg}</p><p>{$msg_line2}</p></div>";
}

WordPress Version: 3.7

function update_nag()
{
    if (is_multisite() && !current_user_can('update_core')) {
        return false;
    }
    global $pagenow;
    if ('update-core.php' == $pagenow) {
        return;
    }
    $cur = get_preferred_from_update_core();
    if (!isset($cur->response) || $cur->response != 'upgrade') {
        return false;
    }
    if (current_user_can('update_core')) {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
    } else {
        $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
    }
    echo "<div class='update-nag'>{$msg}</div>";
}