wp_admin_bar_updates_menu

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

WordPress Version: 6.2

/**
 * Provides an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $updates_text = sprintf(
        /* translators: Hidden accessibility text. %s: Total number of updates available. */
        _n('%s update available', '%s updates available', $update_data['counts']['total']),
        number_format_i18n($update_data['counts']['total'])
    );
    $icon = '<span class="ab-icon" aria-hidden="true"></span>';
    $title = '<span class="ab-label" aria-hidden="true">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text updates-available-text">' . $updates_text . '</span>';
    $wp_admin_bar->add_node(array('id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url('update-core.php')));
}

WordPress Version: 5.9

/**
 * Provides an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $updates_text = sprintf(
        /* translators: %s: Total number of updates available. */
        _n('%s update available', '%s updates available', $update_data['counts']['total']),
        number_format_i18n($update_data['counts']['total'])
    );
    $icon = '<span class="ab-icon" aria-hidden="true"></span>';
    $title = '<span class="ab-label" aria-hidden="true">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text updates-available-text">' . $updates_text . '</span>';
    $wp_admin_bar->add_node(array('id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url('update-core.php')));
}

WordPress Version: 5.8

/**
 * Provide an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $updates_text = sprintf(
        /* translators: %s: Total number of updates available. */
        _n('%s update available', '%s updates available', $update_data['counts']['total']),
        number_format_i18n($update_data['counts']['total'])
    );
    $icon = '<span class="ab-icon" aria-hidden="true"></span>';
    $title = '<span class="ab-label" aria-hidden="true">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text updates-available-text">' . $updates_text . '</span>';
    $wp_admin_bar->add_node(array('id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url('update-core.php')));
}

WordPress Version: 5.4

/**
 * Provide an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
    $wp_admin_bar->add_node(array('id' => 'updates', 'title' => $title, 'href' => network_admin_url('update-core.php'), 'meta' => array('title' => $update_data['title'])));
}

WordPress Version: 3.7

/**
 * Provide an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
    $wp_admin_bar->add_menu(array('id' => 'updates', 'title' => $title, 'href' => network_admin_url('update-core.php'), 'meta' => array('title' => $update_data['title'])));
}