Best e-commerce development company. Best app development company. Best designing company. Best service provider.

Add fields to WordPress user profile

The following snippet will add fields to the WordPress user profile in your profile section. In this code, we provide two fields, Sales Partner and Address. You can add any number of fields. These fields are saved in a user profile. So need to create an extra table to store this data in WordPress.

function add_custom_user_profile_fields( $user ){ echo '

'._e('Profile Information', 'your_textdomain').'

'; echo ''; echo '


}function save_custom_user_profile_fields($user_id ) { if (!current_user_can( 'edit_user',$user_id))return FALSE; update_usermeta( $user_id,'sales', $_POST['address']); update_usermeta( $user_id, 'land', $_POST['land'] ); } add_action( 'show_user_profile', 'add_custom_user_profile_fields'); add_action( 'edit_user_profile', 'add_custom_user_profile_fields'); add_action( 'personal_options_update', 'save_custom_user_profile_fields' ); add_action('edit_user_profile_update', 'save_custom_user_profile_fields');

Recent Blogs


Posted

in

,

by

Tags:

To Know Us Better

Browse through our work.

Explore The Technology Used

Learn about the cutting-edge technology and techniques we use to create innovative software solutions.