From 23e65ecc3d88e9896287520514a3b6d737fda7a9 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 24 May 2024 14:53:28 +0100 Subject: [PATCH] Fix the site editor Admin Bar menu item (#61851) Co-authored-by: youknowriad Co-authored-by: Mamaduka Co-authored-by: ellatrix --- backport-changelog/6.6/6605.md | 3 ++ lib/compat/wordpress-6.6/admin-bar.php | 48 ++++++++++++++++++++++++++ lib/load.php | 1 + 3 files changed, 52 insertions(+) create mode 100644 backport-changelog/6.6/6605.md create mode 100644 lib/compat/wordpress-6.6/admin-bar.php diff --git a/backport-changelog/6.6/6605.md b/backport-changelog/6.6/6605.md new file mode 100644 index 00000000000000..c45a37d77e660b --- /dev/null +++ b/backport-changelog/6.6/6605.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/6605 + +* https://github.com/WordPress/gutenberg/pull/61851 diff --git a/lib/compat/wordpress-6.6/admin-bar.php b/lib/compat/wordpress-6.6/admin-bar.php new file mode 100644 index 00000000000000..8892559cd7f62a --- /dev/null +++ b/lib/compat/wordpress-6.6/admin-bar.php @@ -0,0 +1,48 @@ +add_node( + array( + 'id' => 'site-editor', + 'title' => __( 'Site Editor' ), + 'href' => add_query_arg( + array( + 'postType' => 'wp_template', + 'postId' => $_wp_current_template_id, + 'canvas' => 'edit', + ), + admin_url( 'site-editor.php' ) + ), + ) + ); +} +remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); +add_action( 'admin_bar_menu', 'gutenberg_admin_bar_edit_site_menu', 41 ); diff --git a/lib/load.php b/lib/load.php index b00c024778b5ff..357935b4137794 100644 --- a/lib/load.php +++ b/lib/load.php @@ -130,6 +130,7 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-6.5/script-loader.php'; // WordPress 6.6 compat. +require __DIR__ . '/compat/wordpress-6.6/admin-bar.php'; require __DIR__ . '/compat/wordpress-6.6/compat.php'; require __DIR__ . '/compat/wordpress-6.6/resolve-patterns.php'; require __DIR__ . '/compat/wordpress-6.6/block-bindings/pattern-overrides.php';