• Resolved lenav7

    (@lenav7)


    Greetings

    So I have an enquiry on how to disable amp on desktop only. Kindly please guide me. Thank you.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @lenav7

    Thank you for the support topic, As we checked your site you see seem to be using Transitional Mode with recommended (?amp=1) URL structure, by default AMP will not be served as a Desktop site instead, the normal Page (non-AMP page) is served on the desktop.

    If you have enabled mobile redirection from AMP settings it will redirect non-AMP pages to AMP only on Mobile devices.

    If you have used/added reference to a link with ?amp=1 parameter it will open those links on AMP even on desktop.

    However, you can use the following code snippet in your theme’s functions.php or in a custom plugin to redirect AMP pages on desktop to non-AMP pages.

    add_action(
    	'wp',
    	function() {
    		if ( ( function_exists( 'amp_is_request' ) && amp_is_request() ) && ( function_exists( 'amp_is_available' ) && amp_is_available() ) && ! wp_is_mobile() ) {
    			wp_safe_redirect( esc_url( remove_query_arg( 'amp' ) ), 302 );
    			exit;
    		}
    	}
    );
    Thread Starter lenav7

    (@lenav7)

    Hi Milind,

    Thank you for reaching out to me.

    Yes indeed, I switched from standard template to transitional mode and enabled mobile redirection. Is this sufficient enough to disable amp on desktop only or I need to add in the code snippet also? Thank you ??

    Plugin Support Milind More

    (@milindmore22)

    Yes, that should be sufficient! no need to add the code snippet since you switched to Transitional mode from Standard Mode.

    Thread Starter lenav7

    (@lenav7)

    Thank you so much for your quick help. Have a great day ahead ??

    Plugin Support Milind More

    (@milindmore22)

    Glad we are able to answer your queries, I will mark this as resolved. Feel free to open a new support topic if you continue to encounter issues.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disabling AMP on dekstop only’ is closed to new replies.