function my_show_extra_profile_fields($user) { ?> <h3>Extra profile information</h3> <table class="form-table"> <?php foreach (author_meta_tags() as $meta) { ?> <tr> <th><label for="twitter">Twitter</label></th> <td> <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr(get_the_author_meta('twitter', $user->ID)); ?> " class="regular-text" /><br /> <span class="description">Please enter your Twitter username.</span> </td> </tr> <?php } ?> </table> <?php }
function my_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } $meta_tags = author_meta_tags(); foreach (author_meta_tags() as $meta) { update_user_meta($user_id, $meta['name'], $_POST[$meta['name']]); } }