xwp / site-performance-tracker

Allows you to detect and track site performance metrics
GNU General Public License v2.0
96 stars 15 forks source link

Use `wp_json_encode()` instead of `esc_js()` #5

Closed delawski closed 5 years ago

delawski commented 5 years ago

As per a recent WordPress VIP review of the plugin, an issue has been raised that we shouldn't use esc_js() in Plugin.php, L165:

return sprintf( "<script>performance && performance.mark( 'mark_%s' );</script>\n", esc_js( $mark_slug ) );

Instead, as per VIP best practices we should use wp_json_encode().