Saving changes in wp_editor
I’ve been trying this for ages. I have this textarea in my plugin, that I’d like to replace with wp_editor. wp_editor gets the data but doesn’t set it when changes are made.
Here’s my textarea (it save’s the data precisely):
<textarea id="im_description<?php echo $rowimages->id; ?>" placeholder="<?php echo __( 'Description', 'portfolio-gallery' ); ?>"
name="im_description<?php echo $rowimages->id; ?>"><?php echo
esc_html( stripslashes( $rowimages->description ) ); ?></textarea>
Here’s my editor code (displays the data, but doesn’t update it when i change it in the editor):
<?php wp_editor( $rowimages->description, 'mysecondeditor'); ?>
This would be a great tutorial for people who’d like to use the editor in their plugins.
EDIT: switched to wp_editor, because the_editor was deprecated.
EDIT no. 2: Done this update function but it doesn’t seem to work. What am I doing wrong?
<?php if( isset( $_POST[$editor_id] ) )
update_post_meta( $content, 'editor_id', wp_kses( $_POST['editor_id'], $allowed ) );?>
My textarea:
<textarea rows="20" autocomplete="off" cols="40" name="im_description10" id="im_description10">text</textarea>
WP_edit text
<textarea id="im_description10" placeholder="Description" name="im_description10" style="height: 122px;" aria-hidden="false">text</textarea>
WP_edit rich
<body id="tinymce" class="mce-content-body im_description10 locale-lt-lt mceContentBody webkit wp-editor html4-captions" data-id="im_description10" contenteditable="true"><p>text</p></body>
Leave an answer
You must login or register to add a new answer .