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.
$_POST['feeling']
? -feeling
is editor id.