Reply To: Add custom field to profile general settings and save it
I think ‘bp_init’ is the wrong hook.. Try using ‘bp_core_signup_user’
function save_wc_address() {
if ( wp_verify_nonce( $_POST['bp_settings_general'] ) ){
$user_id = sanitize_text_field( $_POST['user_id'] );
//sanitize input data
$billing_phone = sanitize_text_field( $_POST['billing_phone'] );
//update user meta
update_user_meta( $user_id, 'billing_phone', $billing_phone);
}
}
add_action( 'bp_core_signup_user', 'save_wc_address');