I have the following fields to create a child post with content based on some generic fields.
$notes = $_POST['notes'];
$date_checked = $_POST['date-checked'];
$checked_by = $_POST['checked-by'];
$photo = $_POST['photo'];
$title = "Log Item " . $date_checked . $checked_by;
$slug = sanitize_title($title);
$log_item = array(
'post_title' => $title,
'post_name' => $slug,
'post_content' => $content,
'post_status' => 'publish',
'post_type' => 'log-item',
'meta_input' => array(
'wpcf-notes' => $notes,
'wpcf-date-checked' => $date_checked,
'wpcf-checked-by' => $checked_by,
'wpcf-belongs-to-id' => $post_id,
'wpcf-photos' => $photo,
),
);
$log_item_id = wp_insert_post( $log_item , $wp_error );
I'm trying to set the post date using the value of
, but this seems to send as an array- not sure why that would be since it's a single date value? For example, currently above code produces a log item titled "Log Item Array User"