• Resolved Akki

    (@luckyankit)


    Hi,

    I saw that AMP plugin is adding ?amp on all URLs and I need to know if there is any way to exclude a particular URL to send the user to non-AMP pages. I’ve some elements on custom post type which only works on non-AMP pages. Hence I included a notification to send users to non-AMP pages if they want and now that URL is also getting rewritten to AMP URL.

    How do I exclude that URL from rewriting?

    I’ve only added href="<?php the_permalink();?>" to add the current URL via amp-user-notification function.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @luckyankit !

    The the_permalink() looks to be picking up the current AMP URL of the post seen in the source code for the notification.

    Is it just for that particular post? You could exclude the post from being served as AMP in the editor.

    This topic provides a way to exclude (custom) post types from being served as AMP by default if that’s something you’re interested in doing too.

    Plugin Author Weston Ruter

    (@westonruter)

    I believe this issue is arising due to AMP-to-AMP linking which was added in 1.4.0. There is an issue on GitHub about finding a way to selectively turn it off: https://github.com/ampproject/amp-wp/issues/3689

    You can turn it off entirely via the amp_to_amp_linking_enabled filter, for example:

    add_filter( 'amp_to_amp_linking_enabled', '__return_false' );

    Please confirm if that resolves the issue.

    Thread Starter Akki

    (@luckyankit)

    Yes, adding filter resolves the issue but I updated the plugin to get AMP to AMP linking. Otherwise, I was very happy with the 1.2 version where I didn’t have Posts CSS issue as well.

    @reneesoffice This is for every question (custom post). And I want to serve those as AMP, just need a way to send users back to non-AMP when needed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Exclude URL’s from Rewriting in AMP pages’ is closed to new replies.