When I try to update from 4.0.11 to 4.0.12 or 4.0.16 (and a few others I’ve tried in-between), the snippets don’t work anymore.
I get an error in the console ‘Uncaught SyntaxError: invalid escape sequence.’ [I have PHP, HTML and JS snippets].
I’ve been waiting before I post about the issue as this type of thing usually gets sorted in a next update, but I’m still getting the issue quite a few updates in, and while for 4.0.11 ‘don’t click links you are sent’ is a pretty good deterrant in the meantime for this vulenrability for the admins, it’s a vulnerability I’d like to remove.
I just want to make sure this is an issue you’re aware of and is still in the progress of being sorted.
If any more details would be helpful for the issue, let me know.
In the meantime, thanks for the awesome plugin, it’s been a great help for a long time!
Thank you for reporting this and for the detailed explanation. We really appreciate you taking the time to test multiple versions before posting.
The Uncaught SyntaxError: invalid escape sequence error is typically related to how certain characters are being parsed in JavaScript, and it may be triggered by specific snippet content or changes introduced in recent updates.
We like to investigate this further to identify the exact cause.
Could you please provide:
The WordPress version you’re currently running
Your PHP version
An example snippet (or a simplified version) that breaks after updating
Confirmation whether the issue occurs with all snippets or only specific ones
If possible, also let me know whether the issue persists with all other plugins temporarily disabled and a default theme activated. This will help rule out conflicts.
Thank you for your patience while we look into this. I’ll do my best to resolve it as quickly as possible.
Thank you for your detailed explanation and for your patience.
The issue you described — specifically the console error “Uncaught SyntaxError: invalid escape sequence” affecting PHP, HTML, and JS snippets after updating from 4.0.11 — was related to how certain characters were being processed in newer versions.
Our team has identified the root cause and released a new version that resolves this behavior.
Please update to the latest version and clear your browser/site cache before testing. The snippets should now execute correctly without triggering the console error.
We also appreciate your concern regarding the vulnerability in 4.0.11 — updating to the latest version is strongly recommended to ensure both functionality and security.
The newest version 4.0.17 is changing the javascript/jQuery quotes and apostrophes in the JS post snippets to escaped \’ and ", and new line breaks are being converted to \n, and that’s how it’s being output to the page, which is breaking the code, and giving the console error: Uncaught SyntaxError: invalid escape sequence Rolling back to the 4.0.11 version this issue isn’t present.
Example snippet with the error: jQuery( ‘.frb_button’ ).on( ‘mouseenter’, function() { var color = jQuery(this).attr(‘data-hovertextcolor’); var bgcolor = jQuery(this).attr(‘data-hoverbackcolor’); jQuery( this ).css( {“background-color”: bgcolor, “color”: color } ); } ); With 4.0.17 in the console it turns into:
jQuery( \'.frb_button\' ).on( \'mouseenter\', function() { var color = jQuery(this).attr(\'data-hovertextcolor\'); var bgcolor = jQuery(this).attr(\'data-hoverbackcolor\'); jQuery( this ).css( {"background-color": bgcolor, "color": color } ); } );
Whereas in 4.0.11 when I look in the console, it looks as it does in post-snippets (no escaping).
I think it’s only the JS snippets that are having this problem, that start in the code editor with the premade <script> tag start. eg.
Thank you for the detailed example and for testing the latest version.
It appears the JavaScript is being escaped during output, which is causing the invalid escape sequence error. We’ve shared this case with our development team to review the JS snippet handling, especially when the <script> tag is used in the editor.
We’ll investigate this and provide an update as soon as possible.
Thank you for your patience and for reporting this.
We have prepared an updated build that includes a fix for the JavaScript escaping issue you reported. We are sharing this build with you so you can test it on your site.
Please install the attached version and check whether the snippets work correctly without the escaping and console error. Let us know the results after testing.
Once you confirm that everything is working properly on your end, we will proceed with releasing this fix in the official plugin update.