I would like to create a custom post when my form is submitted and insert form data into that custom post.
When I searched I found a suggestion to use "Gravity forms and gravity forms+custom post type". But I need my own solution.
This is my code:
$title= $_POST['your_name']; $decription=$_POST['e_mail']; $my_post = array( 'post_title' => wp_strip_all_tags( $title ), 'post_content' => $decription, 'post_status' => 'publish', 'post type' => 'EmpResume' //'post_author' => 1, //'post_category' => array( 8,39 ) ); // Insert the post into the database wp_insert_post( $my_post );
But it stored my form data in "wp_posts" table rather in my custom post.