Hi there,
I’m the developer of the WordPress Popular Posts plugin.
To explain better the situation: WordPress Popular Posts version 5.2 injects a application/json
script into the <head>
section of the page that contains a JSON string, for example:
<script type="application/json" id="wpp-json">
{"sampling_active":0,"sampling_rate":"100","ajax_url":"https:\/\/www.example.com\/wp-json\/wordpress-popular-posts\/v1\/popular-posts","ID":false,"token":"a787dd82b4","lang":null,"debug":true}
</script>
When this plugin is active, this inline application/json
script is apparently bundled with the rest of the minified code (or removed altogether from the page), breaking WordPress Popular Posts’ ability to track pageviews, display widgets, etc.
application/json
script tags should be safe to exclude from the JS minification/bundling process as the browser doesn’t execute them (they’re just JSON strings) and they won’t load (external) JS files either.
Other solutions I tested (like Autoptimize) do seem to leave these <script type="application/json">...</script>
tags alone so I’m hoping you could implement this as well in your plugin for better compatibility with WPP and other plugins using <script type="application/json">...</script>
tags.
If you have any questions don’t hesitate to reach out.
Thanks in advance!
-
This reply was modified 4 years, 8 months ago by
Hector Cabrera. Reason: Fixed script tag