Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active July 26, 2021 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpscholar/1224069 to your computer and use it in GitHub Desktop.
Save wpscholar/1224069 to your computer and use it in GitHub Desktop.
Add additional contact methods to a WordPress user profile
<?php
/**
* Add additional contact methods to a WordPress user profile
*/
function more_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter username';
$contactmethods['facebook'] = 'Facebook URL';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'more_contactmethods' );
@wpscholar
Copy link
Author

@ayoubkhan558 It sounds like you added it to the theme. The best practice would be to add it to a plugin. The reason is if we code it into the the theme and then a user switches themes, they lose that functionality. A theme should really just impact the look and feel of a site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment