AMP Script being moved from into
-
Hi,
We are having a weird issue with our website. We have code that injects some AMP scripts into the head of our document if the page is an AMP page denoted by a query param of ?amp in the URL.
Here is the code:<?php function func_name() { if ( function_exists( 'amp_is_request' ) && amp_is_request() ) { ?> <script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script> <script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"></script> <script async custom-element="amp-video-docking" src="https://cdn.ampproject.org/v0/amp-video-docking-0.1.js"></script> <script async custom-element="amp-video-iframe" src="https://cdn.ampproject.org/v0/amp-video-iframe-0.1.js"></script> <?php } } add_action( 'wp_head', 'func_name' );The problem is when we load the AMP page that is linked. The consent script appears in the body and the others remain in the head. We are assuming the AMP plugin is moving this script.
Is there anyway we can ensure all these scripts remain in the Head of the document?
Thanks
The page I need help with: [log in to see the link]
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘AMP Script being moved from into’ is closed to new replies.
