0

I used to use a normal textarea and tried to change the wp_editor on front-end.

<div class="small-12 large-12 columns">
    <textarea name="post_content" 
              rows="10" 
              cols="20" 
              placeholder="Briefly describe yourself. please do not put your email or phone number">
        <?php echo get_the_content($resume_id); ?>
    </textarea>
</div> 

It works fine and I tried to change to wp_editor.

<?php

    $post      = get_post($resume_id, OBJECT, 'edit');
    $content   = $post->post_content;
    $editor_id = 'editpost';
    $settings  = array('textarea_name' => 'post_content');

    wp_editor($content, $editor_id, $settings );
?>

On next step, get the value like this.

$post_content = $_POST['post_content'];

when I use a normal textarea, it works fine, but It's not working with wp-editor. I have tried on Edit page, the value gets not updated content.

Let's say the original content is "123" and updated "12345" and hit update button.

$post_content = $_POST['post_content'];

it gets "123" only.

Did i missed something?

  • do you have any javascript errors? – Mark Kaplun Dec 24 '13 at 9:07
  • no script error. – pulla Dec 26 '13 at 5:34
1

$editor_id (string) (required) HTML id attribute value for the textarea and TinyMCE. (may only contain lower-case letters)

http://codex.wordpress.org/Function_Reference/wp_editor

The second parameter passed to wp_editor needs to match the id attribute of the textarea, not the name attribute. Your textarea doesn't even have and id add one, then use that.

<textarea id="mypostcontent" name="post_content" rows="10" 
  • that's the old one, and I didn't use id. but for wp-editor, I added id. $editor_id = 'editpost'; but it's not working. – pulla Dec 26 '13 at 5:33
  • Using the id, it works when I test it. There is something else interfering. – s_ha_dum Dec 26 '13 at 14:29

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.