Trying to save and display a wp_editor()

Like the title said, I want to save and display the content of a custom form, i’m using woocommerce and wp-crowdfunding. each time i create a “campaign” wp-crowdfunding create a product. That said, here a bit of my code :

The form part :

 $saved_teamdesc_content = get_post_meta( $post->ID, 'wpneo-form-team-description', true);
        wp_editor( $saved_teamdesc_content, 'wpneo-form-team-description', array('editor_height'=>300) );

The action part :

function save_wp_editor_fields(){
global $post;
echo "post_id =>" . $post->ID . "<=\n";
echo "post_meta =>" . get_post_meta( $post->ID, 'wpneo-form-team-description', true) . "<=\n";
update_post_meta($post->ID, 'wpneo-form-team-description', wp_kses_post( $_POST['wpneo-form-team-description'] ) );
}
//add_action( 'save_post', 'save_wp_editor_fields' );
add_action( 'wpneo_crowdfunding_before_campaign_submit_action', 'save_wp_editor_fields' );

The form is not saved, I tried some echo, but they show no result.

Did i missed something ?
Thanks in advance

Edit :
Ok so i found out how to save the post, i selected the wrong id “ID” and it was
“edit_post_id” so the code is :

update_post_meta($_POST['edit_post_id'], 'wpneo-form-team-description', wp_kses_post( $_POST['wpneo-form-team-description'] ) );"

Now i try to get back this content in the form when i want to edit it instead of a blank form.
It seems to not find the id of the post, i tried echo $_POST[‘ID’] & $_POST[‘edit_post_id’] and it display no results

0

Leave a Comment