I would like to replace a textarea in a wordpress plugin with the wp editor if possible. Here is the textarea code:

<textarea id="<?php echo esc_attr( $html['id'] ); ?>" class="awpcp-textarea required" <?php echo $html['readonly'] ? 'readonly="readonly"' : ''; ?> name="<?php echo esc_attr( $html['name'] ); ?>" rows="10" cols="50" data-max-characters="<?php echo esc_attr( $characters_allowed ); ?>" data-remaining-characters="<?php echo esc_attr( $remaining_characters ); ?>"><?php /* Content alerady escaped if necessary. Do not escape again here! */ echo $value; ?></textarea>

I would appreciate anyone's help. I'm not a coder per se. Thank you in advance for your help.


  • I am assuming you are trying not to alter the plugin? That seems like it would be the only way. – Samyer Mar 23 '17 at 19:08
  • Oh no, I could alter the plugin. Not a problem. thanks – Peter Mar 25 '17 at 5:06

You would need to edit the plugin and insert an instance of the wp_editor instead of that textarea.

Refer to the wp_editor function reference.

| improve this answer | |
  • 1
    Ok, thank you very much for your help!! It is much appreciated. I will try this out and reply here as to how it goes. Thank you again!! – Peter Mar 26 '17 at 23:12
  • I successfully replaced the textarea with wp_editor. However it is stripping out for instance using the iframe html tag and others as well. How can I alter this? Thank you again. – Peter Apr 1 '17 at 22:01

Try this:

<?php wp_editor( $value, $html['id'], array(
    'textarea_name' => $html['name'],
    'textarea_rows' => 10,
) ); ?>

If you need set read only for editor see How to make the wordpress editor readonly?

| improve this answer | |
  • Assuming that the question is useless and just providing an un-related different approach isnt an answer. – Sagive SEO Feb 10 '18 at 14:15

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.