添加编辑评论链接,等待审核计数气泡。

原型

wp_admin_bar_comments_menu( WP_Admin_Bar $wp_admin_bar )

参数

$wp_admin_bar (WP_Admin_Bar) (Required)

源文件

路径:wp-includes/admin-bar.php

<?php
...
function wp_admin_bar_comments_menu( $wp_admin_bar ) {
	if ( !current_user_can('edit_posts') )
		return;
	$awaiting_mod = wp_count_comments();
	$awaiting_mod = $awaiting_mod->moderated;
	$awaiting_text = sprintf( _n( '%s comment awaiting moderation', '%s comments awaiting moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) );
	$icon  = '<span class="ab-icon"></span>';
	$title = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
	$title .= '<span class="screen-reader-text">' . $awaiting_text . '</span>';
	$wp_admin_bar->add_menu( array(
		'id'    => 'comments',
		'title' => $icon . $title,
		'href'  => admin_url('edit-comments.php'),
	) );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_admin_bar_comments_menu/