I can successfully create a WordPress custom post using a form. The issue I have is I can't get the post meta into the custom post type.
In my form processor file:
$custom1 = isset($_POST['custom1']) ? $_POST['custom1'] : '';
$custom2 = isset($_POST['custom2']) ? $_POST['custom2'] : '';
require_once('../../../wp-load.php');
//Insert form data into post array
$post_information = array(
'post_title' => wp_strip_all_tags($title),
'post_content' => $description,
'post_type' => 'review-listing',
'post_status' => 'draft'
);
wp_insert_post($post_information);
if ($post_id) {
// insert post meta
add_post_meta($post_id, 'custom1', $custom1);
add_post_meta($post_id, 'custom2', $custom12);
}
Thanks,