Best way to allow manageable social media URLS?

The best way is on the user profile page using the contact methods extension:

add_filter( 'user_contactmethods', 'more_contactmethods' );
function more_contactmethods( $contactmethods ) {
    $contactmethods['twitter'] = 'Twitter username';
    $contactmethods['facebook'] = 'Facebook URL';
    return $contactmethods;
}

This adds fields to the user profile page for those social networks. You can have as many as you like, then you can use that data in a widget or via a template tag in the following way:

$twitter = get_usermeta( $user_id, 'twitter' );

Actually writing the widget or template tag is a separate question though.

Leave a Comment