Title: Invalid Inline Script
Last modified: March 7, 2024

---

# Invalid Inline Script

 *  Resolved [chasndav04](https://wordpress.org/support/users/chasndav04/)
 * (@chasndav04)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/invalid-inline-script-3/)
 * When I create a new post, and before I publish it, I always get this error in
   the AMP Validation:
 *     ```wp-block-code
       {"node_name": "script","parent_name": "head","code": "DISALLOWED_TAG","type": "js_error","node_attributes": [],"text": "\n\t( function() {\n\t\tvar query = document.location.search;\n\n\t\tif ( query && query.indexOf( SINGLE_QUOTED_STRING ) !== INT ) {\n\t\t\twindow.name = SINGLE_QUOTED_STRING;\n\t\t}\n\n\t\tif ( window.addEventListener ) {\n\t\t\twindow.addEventListener( SINGLE_QUOTED_STRING, function() { window.name = SINGLE_QUOTED_STRING; } );\n\t\t}\n\t}());\n\t\n","node_type": "ELEMENT","sources": [{"type": "core","name": "wp-includes","file": "functions.php","line": 7596,"function": "wp_post_preview_js","hook": "wp_head","priority": 1}],"removed": true,"reviewed": true}
       ```
   
 * The plugin solves this problem by removing the script (thus the published version
   shows no AMP errors). Is there a way to solve this problem before publishing?
   Is it even important if it is being excluded?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finvalid-inline-script-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/invalid-inline-script-3/#post-17485122)
 * Hello [@chasndav04](https://wordpress.org/support/users/chasndav04/)
 * Thank you for reporting the issue, I am able to reproduce the issue when I try
   to preview the draft post. I have reported that [issue](https://github.com/ampproject/amp-wp/issues/7758)
   on GitHub.
 * For now, you can ignore the error, it will be fixed in an upcoming version of
   AMP plugin.
 * We hope this is helpful!
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/invalid-inline-script-3/#post-17529309)
 * [@chasndav04](https://wordpress.org/support/users/chasndav04/) As we didn’t receive
   a response I’ll mark this as resolved. Feel free to open a [new support topic](https://wordpress.org/support/plugin/amp/#new-post)
   if you require any further assistance.

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

The topic ‘Invalid Inline Script’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Milind More](https://wordpress.org/support/users/milindmore22/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/invalid-inline-script-3/#post-17529309)
 * Status: resolved