Commit fb04417
Fix Gutenberg plugin assuming its directory is named "gutenberg" (#78705)
* Fix broken Demo menu link when plugin directory is not named "gutenberg"
The Demo submenu was registered without a callback, so add_submenu_page()
never registered a page hook. In wp-admin/menu-header.php the menu URL then
falls back to a file_exists() heuristic on WP_PLUGIN_DIR/{slug}, which only
matches when the plugin folder is literally named "gutenberg". Running from
gutenberg-build/ (or any other directory) makes the check fail, producing a
broken /wp-admin/gutenberg link that 404s.
Pass a no-op callback so the page hook is registered and the link becomes
independent of the plugin directory name. The admin_init redirect still runs
first, so the callback body never executes.
Fixes #76473
* Fix plugin deactivation when plugin directory is not named "gutenberg"
The version-check failure path hardcoded the plugin slug
'gutenberg/gutenberg.php', so deactivate_plugins() failed to match and
the plugin kept running when installed under a different directory name
(e.g. gutenberg-build/). Resolve the slug from the main file via
plugin_basename( __FILE__ ) so deactivation works regardless of folder name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Fix collaboration activation hook when plugin directory is not named "gutenberg"
The activation hook was registered with the hardcoded slug
'activate_gutenberg/gutenberg.php', so it never fired when the plugin was
installed under a different directory name (e.g. gutenberg-build/), leaving
the wp_collaboration_enabled default option unset on activation. Build the
hook name from the main file's basename via plugin_basename() so it matches
the actual slug WordPress fires regardless of folder name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: 3kori <r1k0@git.wordpress.org>
Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org>1 parent bb021cc commit fb04417
3 files changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
0 commit comments