Add Xtra Profile Information !

faisal / Wordpress

By default, WordPress has limited number of profile information available for users. Say for example you would like users to register to your site but also include their phone number while registering instead of just email address. How to do that ?!

Well, its super easy !

Open your functions.php file or use any file on as a plugin if you like. Place these codes

function show_extra_inforamtion($user){?>
    <h3><?php _e(‘Extra profile info’,’blank’)?></h3>
    <table class=’form-table’>
            <th><label for=”phone”><?php _e(‘Phone’,’blank’); ?></label></th>
                <input type=”text” id=”phone” name=”phone” value=”<?php echo esc_attr(get_the_author_meta(‘phone’,$user->ID)); ?>”/>
                <br/><span><?php _e(‘please enter phone’,’blank’); ?></span>

<?php }
function save_extra_infromation($user_id){
    if(!current_user_can(‘edit_user’,$user_id)){ return false;}


Now checkout your ADMIN-USERS-YOURPROFILE   page from Dashboard. You will see an extra field of PHONE.

Here you can update the information for user. But wait a minute ! this still doesn’t show up a PHONE extra row when registering new user right?  So, here’s what we do:


function add_register_field_validate_phone($sanitized_user_login,$user_email,$errors){
    if(!isset($_POST[‘phone’]) || empty($_POST[‘phone’])){
        return $errors->add( ‘lastnameempty’, ‘<strong>ERROR</strong>: Please provide phone.’ );


add_action( ‘user_register’, ‘insert_register_fields’ );
function insert_register_fields( $user_id ) {

    $phone = apply_filters(‘pre_user_phone’,$_POST[‘phone’]);




Now we are done!

You may add more information in similar way!