WordPress Add/remove contact info for users with user_contactmethods filter hook Enabling most popular social networks

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

function social_profiles( $contactmethods ) {
    
    $contactmethods['facebook_profile']  = 'Facebook Profile URL';
    $contactmethods['twitter_profile']   = 'Twitter Profile URL';
    $contactmethods['google_profile']    = 'Google Profile URL';
    $contactmethods['linkedin_profile']  = 'Linkedin Profile URL';
    $contactmethods['github_profile']    = 'GitHub Profile URL';
    $contactmethods['behance_profile']   = 'Behance Profile URL';
    $contactmethods['dribbble_profile']  = 'Dribbble Profile URL';
    $contactmethods['stack_profile']     = 'Stack Exchange Profile URL';
    $contactmethods['twitch_profile']    = 'Twitch Profile URL';
    $contactmethods['angellist_profile'] = 'AngelList Profile URL';
    
    return $contactmethods;
}

add_filter( 'user_contactmethods', 'social_profiles', 10, 1);

You will get this fileds in your dashboard:

WordPress dashboard screenshot

And this is how you retrieve it in code

<?php $user_stack_exchange = get_the_author_meta( 'stack_profile' ); ?>


Got any WordPress Question?