wp_admin_bar_edit_site_menu( WP_Admin_Bar $wp_admin_bar )

In this article

Adds the “Edit Site” link to the Toolbar.

Parameters

$wp_admin_barWP_Admin_Barrequired
The WP_Admin_Bar instance.

Source

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.	if ( ! current_user_can( 'edit_theme_options' ) ) {	return;	}	$wp_admin_bar->add_node(	array(	'id' => 'site-editor',	'title' => __( 'Edit Site' ),	'href' => admin_url( 'site-editor.php' ),	)	); } 

Changelog

VersionDescription
6.8.0Removed the query args to ensure that the link opens the starting screen of the Site Editor.
6.6.0Added the canvas query arg to the Site Editor link.
6.3.0Added $_wp_current_template_id global for editing of current template directly from the admin bar.
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.