wordpress
wordpress copied to clipboard
Remove JS escaping from `amp_post_template_analytics` filter callback
Removes some extraneous calls to esc_js in the amp_post_template_analytics filter callback as the nested config_data array is already JSON encoded, when printed out to the page, in the AMP plugin:
- https://plugins.trac.wordpress.org/browser/amp/trunk/includes/amp-helper-functions.php#L444
- https://github.com/Automattic/amp-wp/blob/7627ff9ababeb337a6e4b6fcfeb7f21442479246/includes/amp-helper-functions.php#L601
Also the esc_js calls don't seem to be as useful since the output goes to the contents of a application/json script element (i.e., not inline JavaScript):
Escapes text strings for echoing in JS. It is intended to be used for inline JS (in a tag attribute, for example onclick="…")
https://developer.wordpress.org/reference/functions/esc_js/
Thanks!