Title: Wp editor get data
Last modified: August 20, 2016

---

# Wp editor get data

 *  [wptweaking](https://wordpress.org/support/users/wptweaking/)
 * (@wptweaking)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wp-editor-get-data/)
 * Dear All,
    I am currently developing a plugin. I got the following code from 
   the codex
 *     ```
       // Update post 37
         $my_post = array();
         $my_post['ID'] = 37;
         $my_post['post_content'] = 'This is the updated content.';
   
       // Update the post into the database
         wp_update_post( $my_post );
       ```
   
 * I would like to know how to update post content directly from [wp editor](http://codex.wordpress.org/Function_Reference/wp_editor)
   instead of defining it in the code.
 * I tested the following, but as result the post content was deleted and I end 
   up with an empty post:
 *     ```
       // Update post
         $my_post = array();
         $my_post['ID'] = 37;
         $my_post['post_content'] = $_POST["syf_editor"];
   
       // Update the post into the database
         wp_update_post( $my_post );
        wp_editor( $content, syf_editor, $settings = array() );
       ```
   
 * My main need is a way to get the data from [wp editor](http://codex.wordpress.org/Function_Reference/wp_editor).
 * Thanks for any hint on this matter.
 * Pietro

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wp-editor-get-data/#post-3383354)
 * wp-editor() is essentially a fancy textarea form element. You must still provide
   a form tag with it’s action and method attributes, and a submit button or equivalent
   to initiate the form submission. You then can get the content of the editor from
   the $_POST array with the editor’s id/name as key. In your example, $_POST[‘syf_editor’].
 * Once whatever page receives the request, it must extract the form information
   and process it as required, which might include inserting values in the DB.
 * Also note in your example, the reason the editor was blank is you provided the
   content parameter as $content, which was never assigned a value. This value should
   come from the DB somehow, not from a $_POST element.

Viewing 1 replies (of 1 total)

The topic ‘Wp editor get data’ is closed to new replies.

## Tags

 * [front-end](https://wordpress.org/support/topic-tag/front-end/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/wp-editor-get-data/#post-3383354)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
