Today I am going to showing you how to add additional fields to WordPress back-end profile page.  Sometime you might need to add additional fields to the user profile page and you could use below code.

function add_more_profile_fields( $profileuser ) {
           //add your fields here

//call this action hook
add_action( 'show_user_profile', add_more_profile_fields );
add_action( 'edit_user_profile', add_more_profile_fields );

This above code is just adding additional fields to the profile page but we still need to do our own saving and error handling. Here we go,

function more_profile_fields_update( &$errors, $update, &$user ) {
      if($update) {
           // do the error handling here
           if($_POST['job_field'] == null) {
                $errors->add('job_field', '<strong>ERROR</strong>: Job field cannot be empty.', array('form-field' => 'job'));
           else {
                //no error, let's save it here
                update_user_meta($user->ID, 'job_field', $_POST['job_field']);

// hook it to this
add_action('user_profile_update_errors', 'more_profile_fields_update', 10, 3);

Leave a reply


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>