I'm having issues with backslashes being when saving changes to files in the Wordpress theme editor (theme-editor.php). So for example, Appearance > Editor > style.css

I'm fairly certain that the function wp_unslash() from /wp-admin/theme-editor.php is causing this issue, because this function utilizes the stripslashes_deep() PHP function to output the saved data.

Is there a way that I could disable this without hacking the Wordpress core?

And also, this does not happen on each server with my clients, so I'm not sure if my hunch above is correct. Any help would be appreciated.

I currently have to add two backslashes each time I save, in order to make things work correctly. Annoying!


The theme and plugin editor is an abomination, related to times when people where ignoring any security common sense in order to pretend to be user friendly, and if you have to use them then you are doing something terribly wrong.

If you can use the editor then your small problem is not being able to use slashes, your bigger one is that your security (in this case file permissions) sucks.

In addition it is just an horrible tool to edit files so just don't use it.

  • Good point Mark. But the question is "why" it could possibly happen on certain servers, but then not on others. I'm just trying to figure out "why". Thanks for the input here. – Rob Myrick Dec 5 '15 at 15:52
  • Your question includes the answer, since WP core code is the same it is either plugins or server configuration, and this is probably the best guess you will get without giving someone access to your server. – Mark Kaplun Dec 5 '15 at 16:08
  • Ok thank you Mark. What server setting would this be? I can change it myself, but just having trouble of what might cause that issue on a server. Thanks for the help either way – Rob Myrick Dec 5 '15 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.