How do I insert a new post programically while using custom fields defined with the Types plugin?
the following doesn’t quite work, it will create the fields instead of using the ones created with the plugin interface.
$new_post = array(
‘post_title’ => $name,
‘post_content’ => $blurb,
‘post_status’ => $status_wp,
‘post_date’ => date(‘Y-m-d H:i:s’),
‘post_author’ => $_POST[‘user_id’],
‘post_type’ => ‘logic’,
‘post_category’ => array(55)
);
$post_id = wp_insert_post($new_post);
wp_set_post_categories( $post_id, array(55) );
add_post_meta($post_id, ‘status’, $status);
add_post_meta($post_id, ‘access’, $_POST[‘publish’]);
add_post_meta($post_id, ‘format’, $_POST[‘format’]);
add_post_meta($post_id, ‘size’, $_POST[‘size’]);
add_post_meta($post_id, ‘version’, $_POST[‘version’]);
add_post_meta($post_id, ‘blurb’, $blurb);
add_post_meta($post_id, ‘file’, $_POST[‘data’]);
the custom field slug names were ‘status’, ‘access’, ‘format’.. etc
https://ww.wp.xz.cn/plugins/types/