Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Site Editing: Improve compat with 3rd party Customizer links #38598

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

mattwiebe
Copy link
Contributor

Description

Only try to move and/or remove Core's Customizer link when a block theme is active.

Note that this is a real-world issue on WordPress.com, where the AMP plugin uses the Customizer to autofocus an AMP section in the Customizer. You will not see the bug on a standard install as our load order is a bit different so the AMP callback to admin_menu calls prior to gutenberg_remove_legacy_pages, despite both being on the default 10 priority. Any plugin that leverages the Customizer will see its link restored rather than the Customizer itself.

Testing Instructions

Add a customizer-based appearance menu at an early priority. Eg:

add_action( 'customize_register', '__return_false' );
add_action( 'admin_menu', function() {
	add_theme_page(
		'Third Party',
		'Third Party',
		'edit_theme_options',
		'customize.php?autofocus'
	);
}, 9 );

Without this patch, you should see that the Third Party item is restored rather than the Core Customizer link. With this patch, both are maintained, but the Customizer is demoted according to the intent the original code by @Mamaduka in #37175

Screenshots

Before:
Screen Shot 2022-02-07 at 15 23 08

After:
Screen Shot 2022-02-07 at 15 23 45

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, @mattwiebe 👍

Tested, and this PR fixes the issue.

@Mamaduka Mamaduka merged commit 45daf81 into trunk Feb 8, 2022
@Mamaduka Mamaduka deleted the fix/restore-customizer branch February 8, 2022 04:39
@github-actions github-actions bot added this to the Gutenberg 12.6 milestone Feb 8, 2022
@gziolo
Copy link
Member

gziolo commented Mar 28, 2022

@Mamaduka, do you know if this change is also necessary for the WordPress core? I can't see any mention related to that in the PR's description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants