i am trying to create a new cpt automaticly while a new user are registered
i found some codes and finally used this:
* Create new custom post type post on new user registration
*/
add_action( 'user_register', 'beor_cpt', 10, 1 );
function beor_cpt( $user_id )
{
// Get user info
$user_info = get_userdata( $user_id );
// Create a new post
$user_post = array(
'post_title' => $user_info->nickname,
'post_content' => $user_info->description,
'post_status' => 'publish',
'post_type' => 'beor-user', // <- change to your cpt
'post_tehudat-zehut-family-member' =>$_POST['wpcf-tehudat-zehut-user']
);
// Insert the post into the database
$post_id = wp_insert_post( $user_post );
// Add custom company info as custom fields
add_post_meta( $post_id, 'wpcf-tehudat-zehut-family-member', $_POST['wpcf-tehudat-zehut-user'] );
add_post_meta( $post_id, 'wpcf-family-member-email', $user_info->user_email );
}
Now the email goes perfect to the new 'beor-user' cpt but the 'tehudat-zehut-family-member' doesnt work.
Any ideas?