Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thegulshankumar
Created August 14, 2017 06:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thegulshankumar/3a38eb2b1d08394a5fbb7faefc8695c2 to your computer and use it in GitHub Desktop.
Save thegulshankumar/3a38eb2b1d08394a5fbb7faefc8695c2 to your computer and use it in GitHub Desktop.
Remove output of rel=amphtml in official AMP plugin (WordPress)
<?php
// Callbacks for adding AMP-related things to the main theme
/** Using comment syntax at amp/includes/amp-frontend-actions.php file.
add_action( 'wp_head', 'amp_frontend_add_canonical' );
function amp_frontend_add_canonical() {
if ( false === apply_filters( 'amp_frontend_show_canonical', true ) ) {
return;
}
$amp_url = amp_get_permalink( get_queried_object_id() );
printf( '<link rel="amphtml" href="%s" />', esc_url( $amp_url ) );
}
End Comment. **/
@thegulshankumar
Copy link
Author

thegulshankumar commented Aug 14, 2017

Note: In the official AMP plugin, edit amp/includes/amp-frontend-actions.php file for removing rel=amphtml output from the head of non-amp web page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment