Custom Post Type with wp_insert_post
-
I think I found a bug related to custom post types via wp_insert_post.
If you use the simplest version of inserting a post, it creates 2 posts in the custom post type. If I disable this plugin, it only creates one. I love this plugin so I would love to keep it. Is there a fix for this?add_action(‘user_register’, ‘create_bio_post_on_register’, 10, 1);
function create_bio_post_on_register($user_id)
{
$create_bio = array(‘post_title’ => $_POST[‘first_name’] . ” ” . $_POST[‘last_name’],
‘post_status’ => ‘draft’,
‘post_author’ => $user_id,
‘post_type’ => ‘bio’
);// Insert the post into the database
$create_bio_post_id = wp_insert_post($create_bio);
}
The topic ‘Custom Post Type with wp_insert_post’ is closed to new replies.