I'm working on insert data from frontend form in a custom post type I created the post type with the taxonomy in function.php file and it was added successfully in my Dashbord and now I want to get the data from the front end and insert it the custom post type created this the code in myTemplate.php
<?php
$posting = date("y") . date("m") ."-". date("h") . date("i");
if (isset($_POST['submit'])) {
$form_weeding = array(
'form-title' => $_POST['title_cover'],
'from-description' => $_POST['description_cover'],
);
$weeding_id= wp_insert_post($form_weeding, true);
add_post_meta($weeding_id, 'title_cover', $_POST['title_cover'], true);
add_post_meta($weeding_id, 'description_cover', $_POST['description_cover'], true);
update_field('title_cover', $_POST['title_cover'],$weeding_id);
//update_field('description_cover', $_POST['description_cover'],$weeding_id);
}
?>
<form action="" method="POST" class="form wpwd-form init" enctype="multipart/form-data">
<div class="content-flex form-div">
<input type="text" id = "title1" placeholder="<?php esc_html_e( 'Tap your Title Here*' ) ?>" name="title_cover" class="content-margin" nrequired>
</div>
<div class="form-div">
<textarea id="textarea-cover" name="description_cover" rows="5" cols="33" placeholder="<?php esc_html_e( 'Tape your paragraph Here*' ) ?>"></textarea>
</div>
<div class="form-div">
<button type="submit" id="boutton-form" name="submit">Publish</button>
</div>
</form>
but I blocked here I don't how to insert the data in my post type. if any one here can help me I will be thankful thank you in advance