I am using wp_editor in my plugin.

It is displayed on the page as:

<?php wp_editor(get_option('edpp_card_design'), 'edpp_card_design', array(
  'textarea_name' => 'edpp[card_design]'
)); ?>

When I post the form it is returning invalid HTML, doing a print_r on the posted data returns something that looks like this:

<span style="\&quot;color:" #ff0000;\"=""><strong>Some Test School</strong></span>

Viewing it Text in the editor has it right at

<span style="color: #ff0000;"><strong>Some Test School</strong></span>

I don't get why this is happening, am I missing something? Is wp_editor configured wrong here or should I be running the output through a function before I use it?

  • It almost looks like you have a rogue opening quote somewhere that's throwing off the HTML. Have you turned on debugging to see if there's any errors or warnings?
    – Howdy_McGee
    Commented Jun 16, 2016 at 15:43
  • with WP_DEBUG enabled I get nothing outputed.
    – Arcath
    Commented Jun 17, 2016 at 8:38

1 Answer 1


Turns out that the output from wp_editor is safe to save to a database. It needs passing through stripslashes() before echoing into HTML.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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