[Resolved] adding custom fields in types cpt while new user registration
This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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?