How to Add Custom Fields to User Profile – WordPress

Super easy way to add custom fields to the user profile on WordPress. This will take you 3 seconds to implement.

 

function modify_contact_methods($profile_fields) {
  // Add new fields - this can be as many as you like
   $profile_fields['cool_new_field'] = 'Twitter Username';
   // Remove old fields
   unset($profile_fields['some_existing_field_you_hate']);

   return $profile_fields;
}
add_filter('user_contactmethods', 'modify_contact_methods');

//And if you want to retrieve this new variable
echo get_the_author_meta('cool_new_field');

 

Leave a Reply