-
Notifications
You must be signed in to change notification settings - Fork 385
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
Discontinue use of amp endpoint in favor of query var when amp theme support is present #1148
Comments
Aside, this is how to prevent using the // Force using query var instead of endpoint.
add_filter( 'amp_pre_get_permalink', function( $pre, $post_id ) {
return add_query_arg( amp_get_slug(), '1', get_permalink( $post_id ) );
}, 10, 2 ); |
tracking for future update of WP Rig. |
👉 Important follow-up to the removal of the In short, if a site is to have some URLs be native AMP but other URLs be non-native AMP, then this will require waiting until the |
For example, in WP Rig this would require a change to lazy loading, either to wait to call |
👉 This issue was reverted in #1235
It is currently very difficult to add dynamic switching between AMP and non-AMP responses in plugins becauseis_amp_endpoint()
has to be called after theparse_query
action. This means litteringis_amp_endpoint()
calls into the functions that run during the generation of the page, including enqueueing scripts, generating shortcodes, and rendering widgets. The use of the endpoint is also troublesome with flushing the rewrite rules (e.g. #801). Also, the/amp/
endpoint is only eligible for being used on non-hierarchical endpoints. As noted in a support topic:This is bound up with #945, deprecating the
AMP_QUERY_VAR
constant andamp_query_var
filter.When all is said and done,isset( $_GET['amp'] )
is all that would be needed to check if the AMP version is being requested. Note that ifamp
is not available for a given URL, then a redirect to the non-AMP version of the page will still be done.The text was updated successfully, but these errors were encountered: