0

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.

Pete

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

2 Answers 2

1

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.

2
  • 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
    Commented Mar 26, 2017 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
    Commented Apr 1, 2017 at 22:01
-1

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?

1
  • Assuming that the question is useless and just providing an un-related different approach isnt an answer.
    – Sagive
    Commented Feb 10, 2018 at 14:15

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.