Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Twitter handle/username to User Contact Information
<?php
/**
* Add Twitter handle/username to User Contact Information
*
* @param $user_contact
*
* @return array
*/
function user_contact_add_twitter( $user_contact ) {
$user_contact['twitter'] = __( 'Twitter Username' );
return $user_contact;
}
add_filter( 'user_contactmethods', 'user_contact_add_twitter' );
<?php
/**
* Get Twitter username for current post author
*/
$twitter = get_the_author_meta( 'twitter', get_the_author_meta( 'ID' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.