On your WordPress user profile, you’ll notice that WordPress includes “Contact Info” fields to store:
- Website
- Google+
- & Facebook information
However, you can filter those contact methods to also include any other contact methods that you’d like. For example, the snippet below is what we’re usingĀ on this site to also include links to our Github profiles.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'user_contactmethods', 'limecuda_user_contactmethods', 10, 2 ); | |
/** | |
* Filter the Contact Methods to include Github | |
* | |
* @since 1.1.0 | |
* @param array $methods The registered Contact methods. | |
* @param array $user The current user object. | |
*/ | |
function limecuda_user_contactmethods( $methods, $user ) { | |
$methods['github'] = 'Github'; | |
return $methods; | |
} |