Add Extra Fields to User Profile Page

WordPress is still living in the stone age with its contact forms in the User Profile section (AIM? Yahoo IM?). Fortunately, you can add more current contact methods with this simple code snippet

Add Extra Fields to User Profile Page, WordPress user profile extra fields code snippet, you just need to add the code snippet below to your WordPress theme’s functions.php file.


/**
 *
 * Extra Fields to User Profile Page
 */
if ( ! function_exists( 'ns_user_contactmethods' ) ) {
function ns_user_contactmethods( $user_contactmethods ) {
  $user_contactmethods[ 'twitter' ] = 'Twitter Username' ;
  $user_contactmethods[ 'facebook' ] = 'Facebook Username' ;
  return $user_contactmethods ;
}
add_filter( 'user_contactmethods', 'ns_user_contactmethods' );
}

As you can see, each new contact method just needs a name and a label.

 

Read more about userdata here

Thank you for seeing my tutorial and feel free to share and comment :). Do you have a code snippet and you want to see it published on my site? I will be more than happy to do it please send me a message (here)

ABOUT AUTHOR

Nuno

I am a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.

LEAVE A COMMENT

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.