wp_admin_bar_edit_site_menu()WP 5.9.0

Adds the "Edit site" link to the Toolbar.

No Hooks.

Return

null. Nothing.

Usage

wp_admin_bar_edit_site_menu( $wp_admin_bar );
$wp_admin_bar(WP_Admin_Bar) (required)
The WP_Admin_Bar instance.

Changelog

Since 5.9.0 Introduced.

Code of wp_admin_bar_edit_site_menu() WP 6.0

function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
	// 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'  => admin_url( 'site-editor.php' ),
		)
	);
}