Restore ability to customize 'amp' query var when theme support added #1455
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.
In #1148 (PR #1194) it was proposed that the ability to customize the
amp
query var should be eliminated. This was to facilitate themes and plugins to be able to look at the query var early before theparse_query
action to determine if it is going to be an AMP response. However, this had to be undone in #1235 because it is not possible to know whether AMP should be available beforeparse_query
because we need the query vars and queried object in order to determine whether the given request is among the supported post types, supported templates, or if AMP has been disabled for the entire post itself. So the reason for this code is now obsolete.However, there is also a bug that this code introduced. For example, consider a plugin that customizes the slug to
lite
:On such a site in classic mode, the URL to a post would be https://example.com/2018/09/14/foo/lite/
If, however, a AMP were switched over to the new paired mode at present, then the query var is forcibly made
amp
and the above URL would no longer return an AMP version at all but rather the non-AMP version (since the endpoint then would be ignored). No redirect from/lite/
to?amp
would be done. This could be problematic for indexes that have cached the URLs to the AMP version but the AMP version is lost from the URL.So this PR removes the unnecessary code and also fixes the above bug.