• Hi there, on the bottom of my AMP pages ( using this plugin https://ww.wp.xz.cn/plugins/amp/ ), there is a <script> tag in the footer which is causing AMP validation errors:

    Error:
    The tag 'script' is disallowed except in specific forms.

    The script tag:
    <script>function lc_get_cookie(name) {var c = document.cookie;if (c.indexOf(name) != -1) {var x = c.indexOf(name)+name.length+1;var y = c.indexOf(";",x);if (y < 0) y = c.length;return decodeURIComponent(c.substring(x,y));} else return "";}if ((d = document.getElementById("commentform")) != null) { e = d.elements;var z = lc_get_cookie("comment_author_email_a2d6fbd4bfc2bdb09f5c7cdc8b76e612");if (z != "") e["email"].value = z;z = lc_get_cookie("comment_author_a2d6fbd4bfc2bdb09f5c7cdc8b76e612");if (z != "") e["author"].value = z.replace(/\+/g, " ");z = lc_get_cookie("comment_author_url_a2d6fbd4bfc2bdb09f5c7cdc8b76e612");if (z != "") e["url"].value = z;}</script>

    Can this be disabled for AMP pages? There doesn’t seem to be a way to do this using the bypass rules.

    Thanks!
    Patrick

    https://ww.wp.xz.cn/plugins/hyper-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    I made this solution for my website.

    In function.php write this code:

    `php
    // Disable Hyper Cache in AMP pages
    if (strpos(“http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]&#8221;, ‘/amp/’) !== false) {
    global $cache_stop;
    $cache_stop = true;
    }
    `

    This is not the best solution but I tried to remove some Hyper Cache actions but It did’t work.

    Thread Starter fatpat76

    (@fatpat76)

    Thanks lelledaniele !

    I agree, it’s not ideal, but it works!

    I’d love to see this fix implemented inside the plugin.

    Thanks!
    Patrick

    Hello @ all!

    It is also possible to disable the Bypass Option “Don’t serve cached pages to comment authors”

    This will also solve the AMP incompatibility problem. 😉

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Conflict with AMP plugin?’ is closed to new replies.