# wp_admin_bar_comments_menu()

URL: https://chugunov.pro/api-wordpress/functions/wp_admin_bar_comments_menu/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 3.1.0.

## Сигнатура

```php
wp_admin_bar_comments_menu( WP_Admin_Bar $wp_admin_bar )
```

## Описание

Добавляет ссылку на редактирование комментариев со счётчиком ожидающих модерации.

## Параметры

- `$wp_admin_bar` `WP_Admin_Bar` — обязательный. Экземпляр WP_Admin_Bar.

## Исходный код

Файл: `wp-includes/admin-bar.php:1102`

```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(
		/* translators: Hidden accessibility text. %s: Number of comments. */
		_n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ),
		number_format_i18n( $awaiting_mod )
	);

	$icon   = '<span class="ab-icon" aria-hidden="true"></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 comments-in-moderation-text">' . $awaiting_text . '</span>';

	$wp_admin_bar->add_node(
		array(
			'id'    => 'comments',
			'title' => $icon . $title,
			'href'  => admin_url( 'edit-comments.php' ),
		)
	);
}
```

## История изменений

- 3.1.0 — Introduced.

## Связанные

Использует: [`_n`](https://chugunov.pro/api-wordpress/functions/_n/), `WP_Admin_Bar::add_node`, [`wp_count_comments`](https://chugunov.pro/api-wordpress/functions/wp_count_comments/), [`current_user_can`](https://chugunov.pro/api-wordpress/functions/current_user_can/), [`number_format_i18n`](https://chugunov.pro/api-wordpress/functions/number_format_i18n/), [`admin_url`](https://chugunov.pro/api-wordpress/functions/admin_url/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_admin_bar_comments_menu/
