Suppress plugins early when making a Reader theme request#5009
Merged
westonruter merged 3 commits intodevelopfrom Jul 9, 2020
Merged
Suppress plugins early when making a Reader theme request#5009westonruter merged 3 commits intodevelopfrom
westonruter merged 3 commits intodevelopfrom
Conversation
Contributor
|
Plugin builds for 6898ab1 are ready 🛎️!
|
pierlon
suggested changes
Jul 9, 2020
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
pierlon
approved these changes
Jul 9, 2020
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Fixes #4477.
Amends PR #4657
I realized that when a Reader theme is selected, accessing the AMP Customizer currently results in Customizer controls et al being registered even for plugins that are suppressed. The reason for this is that suppression was happening at the
wpaction which is too late (and never even fires) when accessingcustomize.php. Therefore, this PR fixes that problem by checking if the current request is for an AMP Reader theme (whether on the frontend or the Customizer) and, if so, suppresses plugins immediately atplugins_loadedas early as possible.This early-suppression could also be done in legacy Reader mode or Transitional mode since there is a query var which indicates it is an AMP request. Nevertheless, this is unnecessary to do because neither Transitional mode nor legacy Reader mode have separate Customizers. Therefore, only “Reader theme” mode needs this early suppression.
To test this:
(The screenshot isn't correct as the Before shouldn't be showing the bad block!)
Checklist