Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom fields to the author profile fields WordPress
<?php
add_filter( 'user_contactmethods', 'my_new_contactmethods', 10, 1 );
/**
* Add custom fields to the author profile fields
*
*/
function my_new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter'; // Add Twitter
$contactmethods['facebook'] = 'Facebook'; //add Facebook
return $contactmethods;
}
/* Display the field option 1 */
the_author_meta( 'facebook', $current_author->ID );
/* Display the field option 2 */
$current_author = get_userdata( get_query_var( 'author' ) );
?>
<p>
<a href="<?php echo esc_attr( $current_author->facebook );?>">Facebook</a>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment