0

The wp_editor function is working fine concerning the displaying of editor and sending of information, except that the information is never sent as it is.

In a template file responsible of updating posts from front end, var_dumping always shows differences betweeen the content coming from database and content sent by editor via POST variable, even the user changes nothing under the editor.

One of the problems for instance, is that the string sent by POST variable is containing "\ instead of ".

In the website I am creating, I need to display the differences between the edits of a post using PEAR text_diff library. Application tells me that there is always difference between edits, even it is not the case, because even after esc_attr, and strip_tags, there are differences (double quotes for example).

Can you please give me an insight on how to resolve such issue? Are there any techniques to make wp_editor works right? Or should I code my own editor??

Thank you very much for your time and assistance.

6
  • Do you mean \" instead of "\ ? If so, have you tried using stripslashes() on wp_editor's output? – Pat J Nov 7 '13 at 14:30
  • Thank you @PatJ for your feedback. It replaces double quotes " by \". – whiteletters in blankpapers Nov 7 '13 at 14:32
  • 1
    stripslashes() should translate \" to " for you. – Pat J Nov 7 '13 at 14:33
  • Thank you sir I will do it and come back to give a feedback. :-) – whiteletters in blankpapers Nov 7 '13 at 14:34
  • 1
    That's not "strange behaviour" on wp_editor()'s part -- that's part of escaping certain characters in order to safely insert strings into the database, etc. See Data Validation, for example. – Pat J Nov 7 '13 at 14:48
1

Making this an answer so that others can find it:

PHP's native function stripslashes() will translate \" back to " (as well as removing the backslash character from other escaped characters, and changing \\ into \).

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.