WordPress – How to add/remove user details

January 22, 2014

If you need to add extra fields to the WordPress user details page you can.

Here is a simple function that can be added to functions.php to add a telephone number, Skype username, Twitter username and Facebook name to your user details page.

It also lets you remove any details from there also. In the example I have chosen to remove Yahoo IM, Yabber and AIM options.

if ( ! function_exists( 'user_details' ) ) {
	function user_details($profile_fields) {
		// Add new fields
		$profile_fields['telephone'] 	= 	__('Telephone Number');
		$profile_fields['twitter'] 	= 	__('Twitter Username');
		$profile_fields['facebook'] 	= 	__('Facebook Vanity Name');
		$profile_fields['skype'] 		= 	__('Skype Username');
		// Remove old fields
		return $profile_fields;
add_filter('user_contactmethods', 'user_details');

Once that is added these extra details should appear in your contact details section when you edit a user.


Now to use that information on the front end of the site you can simply call WordPress’ get_user_meta() function to display the value added.

So something like:

<?php echo get_user_meta($user_id, 'telephone', true);  ?>