Skip to content

Commit

Permalink
Feature:Make "Edit site" consistently visible in the admin bar and co…
Browse files Browse the repository at this point in the history
…nsistently pointing to the editor page
  • Loading branch information
ptesei committed Nov 30, 2024
1 parent 55913fe commit 7c2abbe
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/compat/wordpress-6.7/admin-bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Changes to the WordPress admin bar.
*
* @package gutenberg
*/

/**
* Adds the "Design" link to the Toolbar.
*
* @since 6.7.0
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
function gutenberg_admin_bar_design_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' ),
)
);
}
remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 42 );
add_action( 'admin_bar_menu', 'gutenberg_admin_bar_design_menu', 43 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.6/post.php';

// WordPress 6.7 compat.
require __DIR__ . '/compat/wordpress-6.7/admin-bar.php';
require __DIR__ . '/compat/wordpress-6.7/block-templates.php';
require __DIR__ . '/compat/wordpress-6.7/blocks.php';
require __DIR__ . '/compat/wordpress-6.7/block-bindings.php';
Expand Down

0 comments on commit 7c2abbe

Please sign in to comment.