0

I'm looking to add a wp_editor() input to my WordPress plugin settings page. I've followed the codex instructions and have run across a problem.

When I comment out the wp_editor line below, the textarea saves content properly and auto-populates the field on page reload.

But, when I comment out the $html = '' line, the wp_editor saves content properly, but DOES NOT auto-populate the field on page reload.

$output = $args[0].'[content]';
    $value  = isset( $args[1]['content'] ) ? $args[1]['content'] : '';
    $id = $args[0].'_content';
    $settings = array( 
        'textarea_name' => $output, 
        'textarea_rows' => '5'
    );  
    wp_editor( $value, $id, $settings );

    $html = '<textarea id="' .$output. '" name="' .$output. '" rows="6" style="width: 90%; padding: 10px;" type="textarea">' .$value. '</textarea>';

    $html .= '<p class="description">' . __( 'Enter default content to be displayed within the WYSIWYG editor, such as "delete this, then start writing". HTML and shortcodes allowed.', $this->plugin_slug ) . '</p><br />';

    echo $html;

My question is, what is happening here? Does the wp_editor() need something extra from me so it can recognize content associated with it and populate the editor when the page loads?

Even if I set $value = 'Hello World!'; I get the same result.

Any help is much appreciated.

1
  • 1
    Unless I'm missing something, I don't think you need to create a <textarea> with wp_editor. Just call it, making sure it gets the correct id and name args handed to it.
    – Dan
    Dec 7, 2014 at 14:25

1 Answer 1

0

Found what I was looking for here - wp_editor textarea value not updating

Better late than never!

Your Answer

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

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