I use WP Customer Area and I collect them with this custom function:
add_action( ‘user_register’, ‘myplugin_user_register’ );
function myplugin_user_register( $user_id ) {
if ( ! empty( $_POST[‘company’] ) ) {
update_user_meta( $user_id, ‘company’, trim( $_POST[‘company’] ) );
}
if ( ! empty( $_POST[‘user_address’] ) ) {
update_user_meta( $user_id, ‘user_address’, trim( $_POST[‘user_address’] ) );
}
if ( ! empty( $_POST[‘zipcode’] ) ) {
update_user_meta( $user_id, ‘zipcode’, trim( $_POST[‘zipcode’] ) );
}
if ( ! empty( $_POST[‘city’] ) ) {
update_user_meta( $user_id, ‘city’, trim( $_POST[‘city’] ) );
}
if ( ! empty( $_POST[‘country’] ) ) {
update_user_meta( $user_id, ‘country’, trim( $_POST[‘country’] ) );
}
if ( ! empty( $_POST[‘company_telephone’] ) ) {
update_user_meta( $user_id, ‘company_telephone’, trim( $_POST[‘company_telephone’] ) );
}
update_user_meta( $user_id, ‘description’, trim( $_POST[‘company’] ) . ‘ – ‘ . trim( $_POST[‘user_address’] ) . ‘ – ‘ . trim( $_POST[‘zipcode’] ) . ‘ ‘ . trim( $_POST[‘city’] ) . ‘ – ‘ . trim( $_POST[‘country’] ) . ‘ – ‘ . trim( $_POST[‘company_telephone’] ) );
}
I collect a lot of custom field from registration form and since your plugin doesn’t not use shortcodes for ACF fields, I decided to put everything in description meta.
Is this hook correct? Do you know a better workaround? Let me know if thers’s a bug in user_description shortcode.
Thank you for your help,
M.