wp_admin_bar_updates_menu( WP_Admin_Bar $wp_admin_bar )
Provide an update link if theme/plugin/core updates are available.
Parameters
- $wp_admin_bar
-
(WP_Admin_Bar) (Required)
Source
File: wp-includes/admin-bar.php
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' ),
)
);
} Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_admin_bar_updates_menu