Amp-wp: Errors in Chrome Console (Tag Disallowed)

Created on 16 Mar 2016  路  9Comments  路  Source: ampproject/amp-wp

I've installed the AMP plugin, but I have errors in Chrome Console. I have two errors saying "The tag 'script' is disallowed except in specific forms." How do I fix these?
The article I'm testing is here: https://pratters.com/android-n-features-id-like-to-see/amp/
screen shot 2016-03-16 at 04 53 01

Most helpful comment

if (stripos($_SERVER['REQUEST_URI'], '/amp/')) {
    if (extension_loaded('newrelic')) {
        newrelic_disable_autorum();
    }
}

All 9 comments

Something is injecting javascript into the page which is not allowed:

<script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,t,n){function r(n){if(!t[n]){var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var o=e[n][1][t];return r(o||t)},o,o.exports)}return t[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(e,t,n){function r(e,t){return function(){o

Looks like New Relic? You should disabled it for AMP pages.

I do not understand where this New Relic javascript is coming from, as I do not have New Relic installed and have not heard of it before. Therefore, I'm unsure how I can delete this. I contacted New Relic customer support, and they could not help me either.

if (stripos($_SERVER['REQUEST_URI'], '/amp/')) {
    if (extension_loaded('newrelic')) {
        newrelic_disable_autorum();
    }
}

@larsschenk I know this is an old thread but I just want to say thank you to save-my-day snippet.

@npbtrac note that this snippet should no longer be required as it is done by the AMP plugin itself as of 0.7: https://github.com/ampproject/amp-wp/pull/932

Thanks @westonruter, just because I didn't use the https://github.com/ampproject/amp-wp but I purchased for Theme Newspaper from TagDiv and they provide AMP and current PHP installation had that NewRelic things so it made a headache so far. BTW, I would like to contribute to https://github.com/ampproject/amp-wp but I can't find the guides to join on Wiki page, can you please show me how (I used to serve NewsCorp AUS where I work on code from XWP).

@npbtrac You can find information for contributing here: https://github.com/ampproject/amp-wp/blob/develop/contributing.md

with this code

if (stripos ($ _ SERVER ['REQUEST_URI'], '/ amp /')) {
聽聽聽聽 if (extension_loaded ('newrelic')) {
聽聽聽聽聽聽聽聽 newrelic_disable_autorum ();
聽聽聽聽 }
}

we can block the extension of new relic at the AMP level, which is where the error in Search Console gives us, the question would be where exactly we should place said code?

Thank you

@walismar The AMP plugin is already doing this as of v0.7:

https://github.com/ampproject/amp-wp/blob/2cab5bbf83f62c6f14725de7f50b6eb6c4781116/amp.php#L319-L322

Was this page helpful?
0 / 5 - 0 ratings