# wp_admin_bar_edit_site_menu()

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

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

## Сигнатура

```php
wp_admin_bar_edit_site_menu( WP_Admin_Bar $wp_admin_bar )
```

## Описание

Добавляет ссылку «Редактировать сайт» на панель инструментов.

## Параметры

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

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

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

```php
function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
	global $_wp_current_template_id;

	// Don't show if a block theme is not activated.
	if ( ! wp_is_block_theme() ) {
		return;
	}

	// Don't show for users who can't edit theme options or when in the admin.
	if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
		return;
	}

	$wp_admin_bar->add_node(
		array(
			'id'    => 'site-editor',
			'title' => __( 'Edit Site' ),
			'href'  => add_query_arg(
				array(
					'postType' => 'wp_template',
					'postId'   => $_wp_current_template_id,
					'canvas'   => 'edit',
				),
				admin_url( 'site-editor.php' )
			),
		)
	);
}
```

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

- 6.6.0 — Added the canvas query arg to the Site Editor link.
- 6.3.0 — Added $_wp_current_template_id global for editing of current template directly from the admin bar.
- 5.9.0 — Introduced.

## Связанные

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

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