Currently trying this but the custom field is not updating
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['post_type'] == 'log' ) {
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
'post_title' => $title,
'post_content' => $description,
'post_category' => array($_POST['cat']), // Usable for custom taxonomies too
'tags_input' => array($tags),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'log',
);
wp_insert_post($post);
if($pid)
{
update_post_meta($pid, "complete", sanitize_text_field( $_POST['complete'] ) );
}
}
do_action('wp_insert_post', 'wp_insert_post');
?>
<form id="new_post" name="new_post" method="post" action="" class="wpcf7-form" enctype="multipart/form-data">
<!-- complete Date -->
<fieldset class="complete">
<label for="complete">complete Date:</label>
<input type="text" id="complete" value="" tabindex="5" name="complete" />
</fieldset>
<fieldset class="submit">
<input type="submit" value="publish" tabindex="40" id="submit" name="submit" />
</fieldset>
</form>