“personal_options_update” action hook is use to a save the extra profile fields section data. This is used with “show_user_profile” action hook.
Copy and paste this sample code in the theme functions.php file
1 2 3 4 5 6 7 8 9 10 11 | function save_user_profile_extra_fields_callback( $user_id ){ if ( !current_user_can( 'edit_user' , $user_id ) ){ return false; } if ( isset( $_POST [ 'comp_address' ] ) ){ update_user_meta( $user_id , 'comp_address' , sanitize_text_field( $_POST [ 'comp_address' ] ) ); } } add_action( 'personal_options_update' , 'save_user_profile_extra_fields_callback' , 20, 1); |
To check on how to add extra profile fields please see HERE