wp_admin_bar_updates_menu

函数


wp_admin_bar_updates_menu ( $wp_admin_bar )
参数
  • (WP_Admin_Bar)
    $wp_admin_bar
    The WP_Admin_Bar instance.
    Required:
定义位置
  • wp-includes/admin-bar.php
    , line 1081
引入
3.1.0
弃用

Provides an update link if theme/plugin/core updates are available.

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   = '';
	$title  = '';
	$title .= '' . $updates_text . '';

	$wp_admin_bar->add_node(
		array(
			'id'    => 'updates',
			'title' => $icon . $title,
			'href'  => network_admin_url( 'update-core.php' ),
		)
	);
}