front post submit using wp_editor

by JJang   Last Updated June 15, 2018 03:08 AM

I am making my theme with studying. I want front-end posting that can be written by users.

I made form. like this.

<form class="rnm_fe_write_contets">
            <ul>
                <li>
                    <div class="rnm_fe_wr_textbox">
                        <input name="fe_title" class="rnm_fe_wr_textarea" placeholder="Title" />
                    </div>
                </li>
                <li>
                    <div class="fe_wr_textbox">
                        <?php
                        $distribution = '';
                        wp_editor(
                            $distribution, 
                            'feeling', 
                            array(
                                'wpautop' => true,
                                'media_buttons' => false,
                                'textarea_rows' =>10,
                                'tabindex' => 4,
                                'tinymce' => array(
                                    'theme_advanced_buttons1' => 'bold, italic, ul, pH, temp',
                                ),
                            )
                        );
                        ?>
                    </div>
                </li>                   
            </ul>
            <input name="fe_submit" type="submit" />

        </form>

And I will submit in front-end like this.

<?php
    $post_data = array(
        'post_title' => isset($_POST['fe_title']) ? sanitize_text_field($_POST['fe_title']) : '',
        'post_content' => '', // how to get this contents from wp_editor??

        'post_status' => 'pending',
        'post_type' => 'feeling',                

    );  



    $post_id = wp_insert_post( $post_data );

    if( is_wp_error( $post_id ) || !$post_id ){
        wp_redirect( site_url('/feeling-submit/') . '?result=failure' );
        exit;
    } 
?>

But I don't know how to get the input-data from wp_editor. Can I have some help?

Thank you.

Tags : wp-editor


Related Questions


&nbsp when I use ENTER for skipping line

Updated March 26, 2015 09:02 AM

How to make shortcode which returns HTML?

Updated May 17, 2015 21:03 PM

disable <script> tags on wordpress text editor

Updated November 08, 2017 16:08 PM

Visual/Text tabs in wp editor Not Showing

Updated August 17, 2016 08:03 AM

Set default "Link CSS Class" in add media admin editor

Updated November 30, 2017 15:08 PM