wp_admin_bar_edit_site_menu

The timeline below displays how wordpress function wp_admin_bar_edit_site_menu has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Adds the "Edit site" link to the Toolbar.
 *
 * @since 5.9.0
 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
 *
 * @global string $_wp_current_template_id
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
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), admin_url('site-editor.php'))));
}

WordPress Version: 6.3

/**
 * Adds the "Edit site" link to the Toolbar.
 *
 * @since 5.9.0
 *
 * @global string $_wp_current_template_id
 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
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), admin_url('site-editor.php'))));
}

WordPress Version: 5.9

/**
 * Adds the "Edit site" link to the Toolbar.
 *
 * @since 5.9.0
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
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')));
}