On this page
wp_admin_bar_edit_site_menu( WP_Admin_Bar $wp_admin_bar )
Adds the “Edit site” link to the Toolbar.
Parameters
$wp_admin_barWP_Admin_Bar Required-
The WP_Admin_Bar instance.
Source
File: wp-includes/admin-bar.php. View all references
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' ),
)
);
}
Related
Uses
| Uses | Description |
|---|---|
| wp_is_block_theme() wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| WP_Admin_Bar::add_node() wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| current_user_can() wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| is_admin() wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| admin_url() wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_admin_bar_edit_site_menu