324 Responses

  1. Huzzer Magazine
    Huzzer Magazine Published |

    Such a great tutorial that you give up there. I will definitely use it for my blog. The best part of the above tutorial is the way you integrate Twitter with user profile – by adding another part of the page when I key in my twitter user profile.

    Besides Twitter’s profile link, it will definitely a good idea to put social bookmarking site especially Stumble Upon’s thumb up icon as I believe that by having that section, it can channel reader’s attention into the section.

    Other than that – link to the latest post of the user maybe – especially for guest blogger as it can help to increase the incentive and motivation of the guest blogger.

    1. Bastin
      Bastin Published |

      sir,i need your help.. out of this…i used magic members word press plugin in my project.in that project i add 1 custom field in the reg form..i want to know the table name of the plugin for store the 1 custom field..if you have any idea please send to my mail id ..thanking you..

  2. Chris Hajer
    Chris Hajer Published |

    Hi Justin. Is there a way to extend this to registration, so that the extra fields are required (maybe optionally required, but the input fields would be there) upon registering? Or alternately, maybe just direct people to their profile upon logging in, to complete their profile? I am thinking of using something like this for extended profiles, sort of a membership database, something I haven’t found a good version of yet (and I think you had similar trouble finding a while back?) It’s an area that’s lacking WordPress plugins.

    I would use this for simple things like name, address, phone, interests, etc. All the things you’d need to know about a member of a club.

    1. Tahir Yasin
      Tahir Yasin Published |


      Thanks for the tutorial, I saw many tutorials about adding custom fields to update user page but I am interested in adding custom fields on “Add New User” page and there is no tutorial available that tells the procedure.

      Can you please help?

      Thank you!

  3. Jean-Baptiste Jung
    Jean-Baptiste Jung Published |

    I’m never disapointed with the quality of your work. This tutorial is simply excellent, I have learnt something soooo cool today 🙂

    Thanks for sharing all this usefull info with us. Have a nice day!

  4. Rarst
    Rarst Published |

    As for usage ideas I am slowly planning collaboration/hobby site, most probably on P2 theme (if I don’t find something more fitting).

    I want to give users some degree of control over what parts (probably compartmentalized as widgets) of site they see, as well as option to filter RSS-embebed content with their keywords.

    I hadn’t even started on actual code, but this technique seems like it will be of use. Thanks for explaining it!

  5. visaap
    visaap Published |

    This week we decided, for the project I’m involved in, that we want to use extra profile-info which the users can manage by themselves; and here is the answer to it.
    Thanx, it’s really a timesaver and right on time 😀

  6. BluXis » Aggiungere un campo personalizzato nel profilo utente su Wordpress
  7. Andrea_R
    Andrea_R Published |

    Nicely done – here’s another idea, instead of the code in functions.php, roll it all into one file, drop it in mu-plugins. Add some shortcode options then users across a WPMU install can whip up their own profile area wherever they like.

  8. WordPress Weekend Resources: September 11, 2009 | Theme Lab
  9. Adam W. Warner
    Adam W. Warner Published |

    Great tutorial Justin, thanks a lot. I had the same thought as Chris above. I know there are a couple plugins out there that attempted the addition of form input fields on the registration form, but if this could ultimately be included in your user role plugin, it would simply be fantastic.

  10. Joost de Valk
    Joost de Valk Published |

    Hey Justin,

    it’s become a lot easier to do this with a patch that I proposed and wrote a couple months back: http://core.trac.wordpress.org/changeset/11784. This is in trunk and will be included, as it looks right now, in 2.9, after that, user fields are filterable, and you could easily add the Twitter profile field just by doing this:

    function add_twitter_contactmethod( $contactmethods ) {
    	// Add Twitter
    	$contactmethods['twitter'] = 'Twitter';	
    	return $contactmethods;

    I’ll do a quick post detailing it all 🙂

    1. hr
      hr Published |

      i use that code but when trying to edit user profiles user.php have error promt

    2. Luis Alberto Ochoa
      Luis Alberto Ochoa Published |

      @Joost de Valk

      Justin only shows a great alternative…

      Justin code is Cool, your code … not …

  11. Andreas Graf
    Andreas Graf Published |

    I could think about custom user fields like “Hobbies”, “Location” or “Occupation” to make the users less faceless.

  12. Joost de Valk
    Joost de Valk Published |

    Post done, check it out: User Contact Fields in WordPress 2.9.

  13. Adam W. Warner
    Adam W. Warner Published |

    I have a feeling your to-do list looks a lot like this.

  14. Amanda
    Amanda Published |

    This is wonderful and so easy to follow, thanks so much for sharing!

    I’m trying to incorporate it into the author archives using this method: http://codex.wordpress.org/Author_Templates

    Is there a way to code the twitter link so that it’ll work outside of the loop?

  15. westi
    westi Published |

    Justin this look cool and familiar (http://blog.ftwr.co.uk/archives/2009/07/19/adding-extra-user-meta-fields/)

    With regard to the improvements in 2.9 – what use-case do you have for anything other than a text box for a contact info attribute of a user?

    (BTW – You don’t need the current_user_can() check when processing the new form fields as the capability has already been checked by the main form processing code but it is always better to be safe than sorry)

  16. CG
    CG Published |

    i’m doing a site whereby each member has their own post… I’d like to see this profile page used as a means to set up their post…. maybe even incorporate a basic tinymce editor?

  17. Deb
    Deb Published |

    Another very informative post Justin. I keep coming back to your site to learn more. Keep up the good work.

  18. amy gail
    amy gail Published |

    I learn so much from you Justin!
    Thanks for this.

    (may I take this opportunity to tell you how nice it would be to have a search option on your site?)

  19. amy gail
    amy gail Published |

    I’m using something similar to this to add links to iTunes and CDbaby for the discography pages on a site I’m working on (http://burntsugarindex.com/making-love-to-the-dark-ages/) but I think your method is a bit more elegant.
    I’m going to have to revisit that…

  20. amy gail
    amy gail Published |

    You’re right – Not so much user profiles
    – I’m thinking along the line of the way you’ve inserted the twitter user name via custom fields and hooked them into the author meta.

    In my case – each CD has it’s own link to iTunes and CDbaby- I’m using custom fields (in custom single post templates) for that now and it works. Your post has me thinking that I can do it a bit more elegantly.
    That’s all

  21. Movers Clendaniel
    Movers Clendaniel Published |

    I’m jealous- what I wouldn’t give to be able to create this kind of code myself! For now, I’ll just have to rely on you. 🙂

  22. Pete
    Pete Published |

    Hey Justin… I would love to see this code along with your user management code to be used for a comprehensive dating site for wordpress…. but integrated with a paypal/different costs for different features thingy.

  23. CG
    CG Published |

    hi Justin.. how would I use this with a text area, checkboxes, drop down list etc…

  24. imtiedup
    imtiedup Published |

    As to extra fields, it would be nice to show either the most recent posts by the user, ‘title-date’ format, or even better allow the author to set permanent links to their favorite posts or both.

  25. John
    John Published |

    This is one area of wordpress that has really been overlooked. So many volunteer organizations use wordpress and could use a membership directory.

    It should be easy to add extra users fields as needed (address, phone, etc).
    The user should have an option button to opt in or out of appearing in the directory.
    The directory would be protected and not viewable unless you were log in.
    The admin would have a slightly different view of directory so everyone is included.
    Even better would be option buttons next to each field to decide which info is ok to display.
    A drag and drop interface to customize where info goes on your directory page.

    This would make wordpress more useful to churches, neighborhood associations, hobby groups etc.

  26. Da importância de conhecer bem o WordPress » Comunidade WordPress-BR
  27. Michael
    Michael Published |

    I’m going to look into doing that – adding custom fields helps your audience tell you more about themselves, and that creates a nice report between you, which, needless to say, is highly beneficial for your blog and online business.

  28. Abu Aufa's Weblog
    Abu Aufa's Weblog Published |

    Great tutorial.. Thanks Justin..

  29. Vince
    Vince Published |

    Great TUT! Can you think of a way to add an mp3 upload field that will allow the visitor to listen to an mp3 sample of someone’s music, such as a band?

  30. Edwin
    Edwin Published |

    Justin, really a outstanding Tut. Thank you fort sharing this.
    Like Vince I would like to know if there is a way to upload. In my case an .jpg or .gif file.
    Any ideas on that.?

  31. Martin
    Martin Published |

    thats a cool tutorial, thank you very much!
    i’m running a website for a cycling club, and i wanted a (protected) page to list all the members full names and contact info like mail adress, home and work phone nr etc.
    Also, each member should be able to modify his own (but only his) data.
    Think your tutorial gave me exactly the tools needed for this.. 🙂

  32. manuel
    manuel Published |

    great idea.

    short and powerful.


  33. WordPress Weekend Resources: September 11, 2009
  34. Daily Digest for September 27th | More Than Scratch The Surface
  35. rZr
    rZr Published |

    Hya, ty for the code/tutorial. You are mentioning an plugin, what will this plugin do exactly?
    Will it add custom fields to User Profile, and automaticly add them to the register process? Maybe also an customized register ‘page’?

    If so I would gladly beta test anything for you. Else I have to write them myself, or together even.

  36. Dan Gayle
    Dan Gayle Published |

    I’ve been working on building up a new theme profile page that conglomerates all of the writer’s social media profiles into one spot, and I think this will work perfectly! Thanks for the tutorial.

  37. tgrimsley
    tgrimsley Published |

    Great work and easy to follow instructions. Keep up the excellent work

  38. Pete
    Pete Published |

    Hi Justin… you still alive these days?

    Just wondering…
    1. Are you planning to release this nifty little code as a plugin?

  39. Manic
    Manic Published |

    Thanks for good article. I appreciate your thoughts and information presented at this time.

  40. Nate Williams
    Nate Williams Published |

    This is so awesome .. thanks! It would be cool to be able to upload various images as well associated with authors .. that could be your next tutorial .. great work!

  41. Ron
    Ron Published |

    You are a bloody champion!!!!

  42. Jauhari
    Jauhari Published |

    I will use it Justin, thanks for this tips

  43. Alex
    Alex Published |

    Another very informative post Justin. I keep coming back to your site to learn more. Keep up the good work.
    This is a Life!

  44. slee
    slee Published |

    is there a way to add the First Name and Last Name fields onto the regitration page?

  45. Laura Kalbag
    Laura Kalbag Published |

    Awesome tutorial, thanks!

    I’ve used it to create a load of biography fields for a band site, so ‘Instrument’, ‘Musical History’ and ‘Influences’ all feature in there. So cool 🙂

  46. Patrik
    Patrik Published |

    Great tutorial!!! I just wonder how you get a textarea instead of regular text field?

  47. Steve B.
    Steve B. Published |

    Justin– as always, great tutorial.

    I’d love to take some of these custom fields and show them in the comments form next to “Website” for instance. Is this possible with these custom fields?


  48. Debbie
    Debbie Published |

    This is a great tutorial.

    I’m doing something similar to what you’ve shown, but have run into one problem – the custom meta data I enter on the profile form gets saved (it displays in my custom author template fine), but once submitted the custom fields are blank on the profile form unless I’m looking at it from within the admin side.

    This is the basic formatting for all the text fields:

    Is there something obvious that I’m doing wrong?

  49. Debbie
    Debbie Published |

    Let me try that again:

    <input type="text" name="company" id="company" value="ID ) ); ?>" />
  50. Nirave
    Nirave Published |

    For some reason I can’t get this to work.

    My profile page doesn’t contain the twitter section & going to a post having put the php my_author_box in single.php brings up this error:

    Fatal error: Call to undefined function my_author_box() in /home/mobileus/public_html/blog/wp-content/themes/inove/single.php on line 58

    (line 58 is where the php my_author_box thing is.)

    Anyone help by any chance? (REALLY WANT THIS LOL!)

  51. Adding Custom User Meta to WordPress User Profiles » WordPress, Electronic Publishing, and Geek Culture » Daniel J. Quinn » DQuinn.net
  52. Daniele Savasta
    Daniele Savasta Published |

    Hi! Thanks for your guide it’s really usefull.
    But I need some more suggestion, what I need to do if I want to upload a pdf file also?
    Something like a resume attached to the profile.
    Thank you so much.

    1. Ben Dunkle
      Ben Dunkle Published |

      I’m interested in this too-how do you make a file upload field? This puts the field on the profile page, but I’m not sure where the resume is going or how to display a link to it on author.php page:

      <input type="file" name="resume" id="resume" value="ID ) ); ?>" />
  53. Mark
    Mark Published |

    Hello !This is nice and wonderful, all the tips so easy to follow, thanks so much for sharing! nice post carry on ….

  54. casey
    casey Published |

    Justin this is awesome. You just saved me tons of time.

  55. Ron Devito
    Ron Devito Published |

    Has anyone attempted to replicate this with friending/supporting on Facebook?

    I successfully implemented this with Twitter.

    Also…any way to add graphics to spruce it up a little bit?

    Thanks much.

  56. Tom Fischer
    Tom Fischer Published |

    How can I do the same with checkboxes, textareas etc?? I greatly appreciate any advice anyone can offer with this. Thanks.

  57. Radek
    Radek Published |

    Hi Justin,

    thank you for the tutorial. I am looking around on how to add some custom user profile field and then use it in a condition. Let’s say to give an access to a page only to some users.

    I guess I can use get_the_author_meta for the condition but how can I add the and edit the field by admin?

    I cannot find anything on that.

    Thank you,


    1. Radek
      Radek Published |

      Hi again. I was not clear the first time. I want only users with admin role to be able to edit the extra profile field and if it is not already there create one. Then I can use get_the_author_meta in a condition. Any idea how to do that? Thank you. R

  58. Riccardo
    Riccardo Published |

    Is it possible to add this new fields during the registration process?

  59. Perry
    Perry Published |

    Great work mate, you are the php man!

  60. aravind
    aravind Published |

    Fantastic tutorial Justin! Thanks a lot!

  61. MrArrow
    MrArrow Published |

    Excellent code. Thanks to this article, I’ve actually taken it several steps further and totally redesigned the user profile form: putting the fields I want, in the order I want them.

    So for my own sanity, I created a separate custom-profile.php file and simply ‘included’ it in the theme’s function.php file.

    Then I hid ALL the default WP user profile areas by adding inline CSS to this custom php file:

    #profile-page h3 {display: none;}
    #profile-page .form-table {display: none;}

    Then I rebuilt the WP user profile form within my custom-profile.php, reusing WP fields where I could (e.g. first name, last name, email, website etc) and creating new fields where I had to e.g. contact details: address 1, 2, 3, 4, zip, tel etc

    I’ve even been able to keep the Password area in (but moved to a more logical section), so users can still change their password.

    The whole user profile section now fits in one screen (no scrolling!).

    1. Mary Ann Stoll
      Mary Ann Stoll Published |

      This sounds fantastic, MrArrow. Can you give us a link?

    2. Radek
      Radek Published |

      hi MrArrow

      that sounds fantastic. Could share your code with us?

  62. WordPress Custom User Fields | WebSiteCleanup.com
  63. Adding Custom Author Information To WordPress Posts | The Design Loft
  64. Ralph
    Ralph Published |

    Thanks for the tutorial Justin. I’m a designer not a developer, so a lot of times my options are limited. I appreciate your work on this subject and will be using the User Profile in sites to come. Keep up the good work!


  65. WordPress Hack for Author Permalinks | WebSiteCleanup.com
  66. Brendan
    Brendan Published |

    One more time, trying the code tag…I’m not spamming, I promise!

    Thanks so much for posting this! I’m creating a corporate intranet and this paired with the (modified) WordPress Users plug-in will basically create a mini social network! Good stuff.

    Some people had asked how to do this with other forms of input, and, praise God for it, I figured out how to do it with the select menu! Here’s the code (I don’t know if there’s a way to format it as code?):

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
    	Extra profile information
    	Favorite Color
    ID ) );
    foreach ($fav_color as $fav_id => $fav) { ?>
      <option  id="" value="">
      Please select your favorite color from this menu.

    Hope this helps someone!

  67. FlossieT
    FlossieT Published |

    This is fantastic and just what I’ve been looking for – we run a multi-author blog, and want to include a list of selected contributors in the sidebar; I’m thinking we can set a custom field for ‘include in sidebar’, and then code a widget to pull through just those contributors that have that flag set.

  68. The Frosty
    The Frosty Published |

    What about radio fields?

    Would this be correct:

    <input type="radio" name="account[]" value="developer" ID ) ) echo 'checked="checked"'; ?> />Developer
                	<input type="radio" name="account[]" value="sponsor" ID ) ) echo 'checked="checked"'; ?> />Sponsor

    And would I have to add just one POST, or multiple?


    update_usermeta( $user_id, 'account', $_POST['account'] );

    Or Two:

    update_usermeta( $user_id, 'account[developer]', $_POST['account'] );
    update_usermeta( $user_id, 'account[sponsor]', $_POST['account'] );

    If I am on the right path.. 😉

  69. The Frosty
    The Frosty Published |

    I figured it out:

    <input type="radio" name="account" value="Developer" id="developer" <?php if ( $account == 'Developer' ) echo 'checked="checked"'; ?> />Developer
      <input type="radio" name="account" value="Sponsor" id="sponsor" <?php if ( $account == 'Sponsor' ) echo 'checked="checked"'; ?> />Sponsor
    update_usermeta( $user_id, 'account', $_POST['account'] );
    1. Lili
      Lili Published |

      Hey Frosty,
      I know this is an old post, but I just tried your code, and it adds the field fine, but it doesn’t seem to be “remembered” when I update the profile, did that work for you?
      Please let me know, I haven’t found any resource on radio buttons or anything actually other than text fields…



      1. Guilherme Alves
        Guilherme Alves Published |

        In this case, i have to add some value to variable $account;

        $account = get_the_author_meta( ‘account’, $user->ID);

        Without declare this before snippet, the if condition {


        Alway be return null.

        Sorry bad english.

        Anyway, thanks for this code, help me alot.

        Happy coding :))

  70. MoeAlza
    MoeAlza Published |

    So for the first bit of code, where exactly do you place it in the functions.php file?

  71. Jerry
    Jerry Published |


    I’ve added the code above to write to the usermeta SQL table and got it to work in Thesis. But, I’d like to save the new field to the “users” database table instead of the usermeta table. I need to query the users database because I’m attempting to omit authors that have a new_field set to “guest” and would like to use the code below for this.

    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE new_field  'guest' ORDER BY display_name"); 

    Any idea how would modify your code above to save to the users databse table instead of the usermeta? To me, the two tables look so different that I decided against just substituting “users” for “usermeta” above. I’m pretty new to coding in WP and appreciate any guidance.

  72. Margarida Fernandes
    Margarida Fernandes Published |

    I have been looking how to do this for a couple of days and I was stuck with the code.
    This really works!!
    But I had to change my function to work because I was putting the code outside The_loop. I wanted twitter and facebook to show in the header of every post by the respective author. This is what I did and it works fine.

    <a rel="nofollow" target="_blank" href="" title="Follow  on Twitter" onclick="javascript:pageTracker._trackPageview('/outbound/article/');"><img src="/images/twitter-32.png" alt="Follow us on Twitter" /></a>
    <a rel="nofollow" target="_blank" href="" title="Follow  on Facebook" onclick="javascript:pageTracker._trackPageview('/outbound/article/');"><img src="/images/facebook-32.png" alt="Follow  on Facebook" /></a>

    Thank you so much for your input.

    my blog is still in development, that’s why I don’t post the link just yet..

  73. Duane
    Duane Published |

    Really great post! Very helpful, I am working on a project where I am using wordpress as a company intranet CMS and this has come very handy. I was sent here from: http://www.dquinn.net/extending-user-profiles-wordpress/ where I had some other great ideas that I integrated into the mix.

    My question for you is can this method be used to create a date of birth field? I want to be able to send birthday cards to each member based on a dob field in the user profile. I am not sure how I would implement this so anything you can contribute would be great.

    Again thanks for the great insight.

  74. Mitch Canter
    Mitch Canter Published |

    I know this is an old post, but it’s still a fantastic resource.

    What most people don’t know is that you can call these fields not only in a function, but also in an author template.

    For example, instead of using the_author_meta, you use
    twitter; ?>

    Allows for some SWEET Mashable style profile pages with bio, social networks, etc on top, and recent posts by author on the bottom.

  75. Creating a Wordpress Plugin That Works With CForms | Jeff's A.D.D. Mind
  76. Ralph
    Ralph Published |


    First off THAN YOU THANK YOU for this post, works perfectly!!! Any ideas on when you’ll release v 0.2 of your members plugin? Would love to make my new fields available upon registering without having to hack any of the core WP files like you mentioned above.

    Thanks again!!

  77. Preston M
    Preston M Published |

    Great information as always. Here is something I’m trying to figure out and I’m not quite sure if that method above works.

    I want to generate automatically unique playerID for each new registered user. This id will be used at live events and later on in a custom app I’m building.

    Later on I want to display this ID view author profile page


  78. Michael
    Michael Published |

    Really old comment thread I know, but just letting you know I just implemented this on a site I work for that needed a “school” field and it worked like a charm.

    Your tutorials hit the sweet spot of (a) very cool functionality and (b) simple to implement. Thanks a lot.

  79. Dan
    Dan Published |

    I know this is an older thread but I need some help here…

    When I do what is displayed above I can see the fields added to the profile page and when I put data in it goes to the tables, BUT it doesn’t get shown when you go back to the profile page. The fields show blank every time you go back to your profile.

    Again, the data DOES go to the database but does NOT populate the field when I return to the profile page.

    Any ideas? I took the code EXACTLY as in the article.

  80. Rakesh Narang
    Rakesh Narang Published |

    Dude seriously your work is awesome but since i am not a coder i didn’t get anything… please help where to add those codes in php after something or just anywhere?

  81. Wordpress user registration template and custom user profile fields
  82. Jonathan Knapp
    Jonathan Knapp Published |

    Just a huge FYI, I don’t know exactly why but WordPress does not like form field names with dashes in them. ex) profile-twitter

    I just spent a lot of time watching the saving process fail without any output or reasoning. Hope this helps someone from pulling all their hair out.

  83. Richard
    Richard Published |

    What I would do with custom profile fields? I would like to see something like Magic Fields but user centered instead of post centered, where I can add custom profile fields (all types), custom profile write panels for WP backend or even for frontend.

    Then I could turn Wordpress in something like a medical records system, where the patients are registered users. I can display a unique page and capture the current logged in user to fill it with the subscriber medical data.

    I can also make hidden alternate pages and change the author value to a specific user then fill the page with that user information (such as for doctors view).

  84. Enhanced WordPress User Profiles, Part 3: Displaying the New Fields in Your Template File | RD2 Blog
  85. jason
    jason Published |

    Love your site. I know that this post was written last September, but the function update_usermeta is depreciated in version 3.0 and you should use update_user_meta.

    Keep up the great website. Thank you.

  86. Elektryk
    Elektryk Published |

    Hm, is there posibility to save data from custom page in user menu in this way?

  87. Schalk Neethling
    Schalk Neethling Published |

    Thanks so much for this awesome article!

  88. Andreas Poloczek
    Andreas Poloczek Published |

    Thanks you too for your great article. Maybe you could help me out with a tip…

    I totally stuck with a solution to sort/show last modified user profiles. In theory i thought it may be possible that a hidden field with the actual time and date will be stored in a seperate user_meta field. Everytime when a user hit the button “update profile” a function should store the time/date in a field like “last modified”. This would give the admin the possibilty to show/sort “last modified” user profiles.

    Sorry for the request, but i searched a couple of days for a tip or solution without success.

  89. Andrea Barghigiani
    Andrea Barghigiani Published |

    Hi Justin congrats for the amazing tutorial!

    I am trying to do the same but with checkboxes, just like CG and Tom Fischer.

    In the user profile page I am trying to create a list of selectable checkboxes, because like hobbies the user can have more than one hobby choosable from my given examples.

    The problem is when I am trying to show the saved information of the user the function esc_attr( get_the_author_meta( 'hobbies', $user->ID ) ); does not show nothing.

    The call at the function update_user_meta( $user_id, ‘hobbies’, $_POST[‘hobbies’] ); is present in to the save function.

    Could you please be so kind to help me up with that?


    1. Glen
      Glen Published |

      I found the problem. That function doesn’t return the actual text. As such, it needs to be concatenated in the string like this:

      Get it?

      1. Glen
        Glen Published |

        Comment system mucked up my code, here’s a pastbin link: http://pastebin.com/f6z9htrR

  90. WP: Extra Author Info : PubMedia Commons
    WP: Extra Author Info : PubMedia Commons at |
  91. Rick
    Rick Published |


    I made an approach to applying taxonomies to user profiles using your code here and modifying it a little bit. If you have the time, I would really appreciate if you could check my detailed post at WordPress.org and let me know what you think.


  92. Keven
    Keven Published |

    How would you validate your custom fields with WordPress when updating user profile?

    Is there a way to add errors to a global variable object WP_Error or hook to a special function.

  93. Karl
    Karl Published |

    Gold man, gold. Been looking how to do this for the last half hour (all the sites i found we’re ancient) so i’m loving you right now.

  94. genoki
    genoki Published |

    I created custom field called ‘location’ in user profile.

    I want to display the new field ‘location’ along with user display name on their comments.


    Bob Smith – New York City, NY

    I have been searching for where I can concatenate my new field to the displayed user name.. but not sure.

    I have searched get_author_name in author template and comments area in function.php but nothing is clearly the author name!

    Any pointers? Thx

    AANMAWEBMIN Published |

    Does anyone know of a way of: bulk importing _users & _usermeta i.e. users, email, password + address1, address2, city, state etc. into a WordPress system, please.

    So far I have been able to bulk add basic user information with dagondesign.com’s http://www.dagondesign.com/articles/import-users-plugin-for-wordpress/

    But this plugin will only import the core WordPress user data (out of the box) a great solution that has gotten me far but what I need is to import _usermeta also.

    Any help will be greatly appreciated!

  96. Kenti
    Kenti Published |


    when i use your code (copy and paste) in my function php, the values are correctly saved in the database and are visible in the user interface but in the admin page the fields are blank. In other words when i came back in the admin page my field “City” is blank and i don’t see the value “London” in it.

    Is there a problem with ID ) ); ?> in wordpress 3.0?

    No problem if i use a non-custon field such as ID ) ); ?>

    If someone has an idea…

  97. Jonathan Clarke
    Jonathan Clarke Published |

    Excellent! Just what I need!

  98. Scott
    Scott Published |

    Excellent! Still helping newbies over a year later.

    One question is it possible to have these custom fields appear in the Admin -> “Add New User” page? (i.e. user-new.php)

    This works great on the edit profile pages, using the “personal_options_update” & “edit_user_profile_update” hooks.

    My problem is that I think I need to use a new hook “add_action(‘user_registration’,…” or similar to accomplish this. But of course that’s not working for me. Just curious if something like this is even possible.

    Using WP 3.0.1

    Thanks in advance,

  99. Thomas
    Thomas Published |

    First off, very helpful tutorial, thanks for writing it. I know it’s a bit late on my part, but in case you still keep up with this page, I was wondering about the best way to update one of the custom user fields from a page other than the profile page. Basically, I’m using user profile fields to store values for an experience-based game and I just need to be able to update the old value with a new value (just contained in another input field on a page) in response to a button click. I know it’ll probably take AJAX to get this done (something about which I know very little) and searching for tutorials has led me to a frustrating dead end. Anyway, if you have any ideas or suggestions, I would be greatly appreciative.

    Thanks very much,


  100. Gill Sans Rides Again / Interconnect IT – WordPress Consultants, Web Development and Web Design
  101. pat
    pat Published |

    thanks for the info. i don’t really get it though. will this allow me to merge custom fields into blog posts, etc? say, i want to merge my name into a post with a custom field, how will this do that? thanks!

  102. Ajay Karwal
    Ajay Karwal Published |


    This is exactly what I needed… My author page is looking slick now!

    I’ve added twitter and facebook so far, and this is how I’ve displayed them.

    <!-- Check for twitter  -->
    <a href="http://twitter.com/" alt="" />twitter</a>
    <!-- Check for facebook -->
    <a href="http://www.facebook.com/" alt="" />facebook</a>

    This ensures that a field only shows up if the author has filled it in

    I wonder, is there a way of simplifying the IF statement to check ALL custom fields and only spit out those which are filled in?

  103. Aaron
    Aaron Published |


    This is a great tutorial, and It helps out a lot. I do have one question, how can I upload several photos into the profile. I want to allow users to upload their photos, and display the photos on their page.

    Thank you,


  104. Jake Rutter
    Jake Rutter Published |

    Could you use custom fields to capture star rating information? There are plugins out there, mostly paid. But a way to do it outside of the plugin might work, especially with new custom post types.

  105. Shag
    Shag Published |

    Howdy. Thanks for the excellent tutorial. I had no problem with the text field and moved on to checkboxes where I’m having some issues. I’m trying to populate a list of checkboxes derived from a custom post type. So I’ve got a custom post type called “Horses” and I want to have a list of those posts on the user’s page. I just can’t get over the hump. Here’s what I have….

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
    	Profile Information
    	ID); ?>
    			 'client_horses', 'orderby' => 'title', 'order' => 'asc' ) ); ?>
    		   		<input value="horse-" id="" name="horses[]" checked="checked" type="checkbox" />
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    	update_usermeta($user_id, 'horses', ( isset($_POST['horses']) ? $_POST['horses'] : '' ) );

    This works fine with a hard coded values but I'm trying to create a unique value using the_ID(); but the_ID doesn't seem to work within the "is_array" (function???)

    it prints out like this:

    as you can see the “546=” is obviously not correct. It should be “checked=”checked”. I’m guessing that this is a php syntax issue caused by my lack of knowledge/understanding.

    Any help would be greatly appreciated.

    thanks, Shag

  106. Shag
    Shag Published |

    that code didn’t print out properly. hopefully this will…

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
    <h3>Profile Information</h3>
    <?php $horse_array = get_the_author_meta('horses',$user->ID); ?>
    <?php query_posts( array( 'post_type' => 'client_horses', 'orderby' => 'title', 'order' => 'asc' ) ); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <li><input value="horse-<?php the_ID(); ?>" id="<?php the_ID(); ?>" name="horses[]" <?php if (is_array($horse_array)) { if (in_array("horse-".the_ID(),$horse_array)) { ?>checked="checked"<?php } }?> type="checkbox" /><?php the_title(); ?></li>
    <?php endwhile; // End the loop. Whew. ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
    return false;
    update_usermeta($user_id, 'horses', ( isset($_POST['horses']) ? $_POST['horses'] : '' ) );


  107. shag
    shag Published |

    I ended up figuring this out thanks to some help from a dev buddy. I was using the_ID() which prints the value rather than get_the_ID() which returns the value (I think anyway). So if you use the code above and replace the bit that’s within the loop with this, it should work…

    <?php $horse_id = get_the_ID(); ?>
    <li><input value="<?php echo $horse_id; ?>" id="<?php the_ID(); ?>" name="horses[]" <?php if (is_array($horse_array)) { if (in_array($horse_id,$horse_array)) { ?>checked="checked"<?php } }?> type="checkbox" /><?php the_title(); ?></li>

    And for those curious folks, I used this on the front-end to display the array: (not sure if it’s the best way but it works for me)

    global $current_user;
    $horse_var = get_the_author_meta( 'horses', $current_user->ID );
    $horse_array = implode(', ', $horse_var);
    echo $horse_array;
    1. Kyle
      Kyle Published |

      Just wanted to let you know that your solution for displaying on the front end worked perfectly for what I was trying to do. I just couldn’t seem to get the code provided in the original tutorial to display the current users new field information. Using current user instead of user id worked like a charm.
      Thank you so much for posting your solution if you hadn’t I would still be stuck.

      1. Tiffany
        Tiffany Published |

        This is harrowing from Adam’s checkbox solution

        Checkbox Test

        ID ); ?>
        		<input TYPE="radio" name="division" value="administration"  />
        		<input TYPE="radio" name="division" value="business_services"  />
        		<input TYPE="radio" name="division" value="educational_services"  />
        		<input TYPE="radio" name="division" value="human_resources"  />
        		Seeing if this works...
        	update_usermeta( $user_id, 'division', $_POST['division'] );
    2. Henning
      Henning Published |

      Hey Shag, great solution – works nicely for me. Thanks!

  108. Lyndsy Simon
    Lyndsy Simon Published |

    Thanks for this! I’m just learning my way around WP, and update_usermeta() puts me on the right track. I’m writing a classifieds ads plugin that supports proper monetization, and planned to tie in regular WP users as posters. This will let me store subscription states and account balances without having to implement my own user classes 🙂

  109. George B
    George B Published |

    Hi Justin,

    Good stuff! I know I’m pretty late to the party here, but I had an idea. I want users to choose ther country of origin (I work in A very international research lab), probably from a dropdown list, and then have this produce a little flag belw ther avatar / in ther biog.

    I was thinking of having each country in dropdown relate to a 2 or 3 letter code, then have the flag image called from a huge library by <img src="path/countries/flag-.jpg">

    Obviously I’ve not written it in full. Is that possible or practical? I’m very new to wp and php and am learning by looking and tweaking. I think I’m learning how to use php and manipulate the database, but still v early stages!

  110. LMP
    LMP Published |

    What I’d like to see as an addendum to this article is how to get that field to show up in the WP User Listing. Easy, I’m sure. 🙂 This was very useful, thanks.

  111. Aaron
    Aaron Published |


    I am using this custom profile code, and it works great. I have created a field called title and one called Department, and I do have a quesiton.

    How can I have these two fields display as read only for everyone else but admin, and allow the admins to edit these. these are fields that I do not want people to be able to edit, so only admins should be able to give each user a different department.

    Thank you,


  112. Aaron
    Aaron Published |


    Does anyone know how to have a dropdown display, like Departments?

    I would like to have in the profile a dropdown that was like so:


    Does anyone know how to do this either like this or through an array?

    Thank you,


  113. Clare
    Clare Published |

    I was looking for the rest of your series on using custom fields for book reviews when I stumbled across this post – which was next on my to do list!

    It would be great if you could link your series posts together – I hear you can do that with a custom field too 😉

  114. shashank
    shashank Published |

    Hey Guys,

    I am trying to give user a capability to add a new page by filling out extra fields in the user profile. Using the above code i have added two fields namely:
    1) Page Title
    2) Page Content

    But i want this page to be published when the user clicks the update profile button.

    can anyone help me with this???


    1. Matt Price
      Matt Price Published |

      @shashank, if you ever figured out how to do that I’d loveto know. I’ve just asked a similar question in the worpdress forums, http://wordpress.org/support/topic/collecting-richer-data-from-user-profiles-and-creating-pages-from-it, feel free to post there as well if you like. Thanks!

  115. Ayaz Malik
    Ayaz Malik Published |

    Awesome tut bro helped me tons.
    there is one part tho im confused and stuck at. how to add checkboxlist (consisting of about 10-15 options) in the user settings page.. and afterwards getting the values on some custom page.
    If you can help me with that it would be awesome 🙂

  116. Neil
    Neil Published |

    Okay, so I’m almost there. After searching for hours I have found what I am looking for, but this is scaring me (I’m too new!) – could you tell me is it possible to do this via OpenHook and how??? Thanks

  117. 10 Awesome WordPress hacks to enhance your blog’s usability | Web Design & Development Blog
  118. Jean
    Jean Published |

    Hi, great tutorial it works fine for me, but I’m trying to display the extra field information on the user.php screen.

    How can I display an extra field from the user profile into User Manager on the Admin Panel wich call user.php

  119. ismail mert
    ismail mert Published |

    i use this codes and modiyied

    thank you justin i have been using your theme “options”

    take care

  120. joey
    joey Published |

    wow, after a couple years this tut still works. thanks for making this easy.

  121. Ac
    Ac Published |

    Is there way to disable the editing of the meta data?
    We have an interesting situation here where we need to have a meta field called “user_balance”, and we need to show it. but the user should not be able to edit it ( obviously!), is there a way to make this happen?

  122. Can Sinan Artuç
    Can Sinan Artuç Published |

    Thank you for sharing this knowledge. I applied to my multi-user blog as Twitter and Facebook.

  123. ken
    ken Published |

    Is there a way to only add this information to the back-end of wordpress when the admin is the only one creating the user accounts?

    I have found plug-ins that do allow for extra fields after the account is made but not at the initial creation. Also like Ac above, those fields would be nice to have as read-only by the actual user.

  124. Scott
    Scott Published |

    I have the same question as Ken. Is it possible to use this on the -> “Add New User” page? (i.e. user-new.php).

    Possibly with a new hook? “add_action(‘user_registration’,…” or similar??


  125. Adding Custom User Meta to WordPress User Profiles » Boston Freelance Web Designer » DQuinn.net
  126. samir
    samir Published |

    It is really a nice tutorial.
    It adds custom fields to the adduser page.
    Is there a way that i can import users with custom fields like (country,region,zip,club) etc.?

    thanks a lot.

  127. Richard Cummings
    Richard Cummings Published |

    Justin, very nice tutorial. I have looking at adding a Twitter box here and this was very helpful. Cheers, Richard

  128. nichive
    nichive Published |

    I managed to implement your code, Justin. Thanks, you’ve saved my time.
    One more thing I need to accomplish, is to allow my user to upload two images on their profile.

    I just haven’t come up with any solution regarding file uploads, can you help me?

  129. Jai
    Jai Published |

    That was very useful. Was working on a user registration page & didnt realize how to add custom fields – this saved my day…


  130. Mikkel
    Mikkel Published |

    Thanks for a great tutorial. Definitely the best one around for adding extra fields. I followed your guide and had no problems.

    I do however have a question: Is it possible to disregard empty fields?

    In your example, if someone doesn’t have a twitter account it looks stupid with an empty field. Does anybody know how to exclude empty user fields?

    1. henning
      henning Published |


    2. henning
      henning Published |
  131. jafar
    jafar Published |

    Thanks for a nice tutorial.
    I need a thing that gives us a code after or beetween register(sign up)
    for exaple : xyutr3

  132. Matt Price
    Matt Price Published |

    @mikkel — I don’t have the solution right in front of me, but I think it’s pretty straightforward to make display of the extra fields conditional on the value of that field being non-null. I think you’ll find more info on codex.wordpress.org. And I think maybe there’s even some hint of how to do it somewhere in the comments here. Hope that helps a little bit.

  133. Neil
    Neil Published |

    I just wrote a tutorial on this, but taking a different approach. In it’s current state it doesn’t use the functions.php page but, instead, a page template for the profile.

    One thing I haven’t quite figured out is how to add profile images using an upload field. I can do this outside of wordpress, but inside any core functions require it to be attached using a post ID. Any thoughts on that would be awesome.

    The tutorial is Wordpress: Custom Profile Page

  134. Random Joe
    Random Joe Published |

    The easiest way to add custom fields in registration form is installing s2Member plugin. Its a membership subscription plugin that integrates with Paypal. Very awesome to use.

  135. Michael
    Michael Published |

    Hi Justin!

    Awesome article, this helped a lot in terms of getting things started on my author profiles. It also worked great sticking this into an author card at the end of posts. I had a quick question though.

    I have a game review website and I’m creating an author profile page and your technique for adding fields worked great. I’m just having issues displaying that data in an author page. I duped my archive.php and using that as a base for the author page template. I’m creating the extra fields for xbox live user name, wii friend code #, Games currently played etc. I can code html/css and very light php, and have been researching this a ton your site has brought me the closest to where i need to be. The goal is to create a cool Author section at the top of their related posts. Can you point me in the right direction or show an example of how to display custom field data in an author page? I’ve been experimenting and doing a lot of searching but haven’t been able to get this to work. Any help is greatly appreciated.


  136. Adrian
    Adrian Published |

    Great article Justin,

    I’ve stumbled across a problem: the custom fields aren’t saved into the ‘old_user_data’ object when accessing the profile_update action hook.

    A client wants to know only the fields that a user changes each time they update their profile. The custom fields come through identical in the new and old objects.

    Have you experienced this before and is there a way to store these custom fields so we can tell which have changed?


  137. Gustavo
    Gustavo Published |

    Great tutorial. How can I make the new fields mandatory? Thanks.

  138. andrew
    andrew Published |

    is there a plugin that do this for me? im a noob at coding and i need to put this in a page. i already made some aditional fields with the register plus redux plugin but i cant show them in a page. thanks!

  139. Adam
    Adam Published |

    For anyone trying to add a checkbox, this works for me:

    1. Adam
      Adam Published |

      Err that didn’t come out right. Code here: http://snipt.org/xmUl

      1. Tiffany
        Tiffany Published |
  140. Hello world! | Share Your Red Light Results
  141. cris
    cris Published |

    Hello justine,
    does this works also on Classipress? It is a classified wordpress theme.

  142. List all authors by matching custom meta data on a category page | SeekPHP.com
  143. Nirmal Sahoo
    Nirmal Sahoo Published |

    Hi, Is there any way, I can add some fields over the “Add New User” page at the Admin end ? These above said methods displays the extra fields on the Profile page. I want to have some fields which should be displayed while creating a new user and should be saved in the usermeta table.

    Of course I don’t want to hack the core…

  144. Ba1drick
    Ba1drick Published |

    Hi Justin,

    Any idea how to display contents of that custom field inside of another function?

    $agent = ”.get_the_author_meta(‘agenttitle’, $user->ID) .”;

    echo $agent;

    Doesn’t do it.

    1. jeff
      jeff Published |

      This might work.

      This author’s Twitter name is ID

      see advanced uses section

  145. Michael Dorf
    Michael Dorf Published |

    Just stumbled on this tutorial – needed to add extra fields for storing Google+ and Facebook info for a user. Copy/paste, enter, enter, done! I wish all tutorials were this effective! Thanks!

  146. Save custom field types with this function…? | SeekPHP.com
  147. MadsRH
    MadsRH Published |

    Great tutorial, but can I save data from radio buttons? I’ve tried the suggestion above, but it doesn’t save the data 🙁

    This is my code: http://pastebin.com/cbf98YrH

    I hope you can help me.

  148. Aidan Boyle
    Aidan Boyle Published |

    Thanks so much for this tutorial Justin. This was such a lifesaver one of my projects I’m working on and is going to be key in another project coming up. This was so awesome!

  149. sabali
    sabali Published |

    thanks very much for this tutorial Justin. I have not tried it on my site but already it has given me a full incite to doing so.

    Thanks very much

  150. jhuna
    jhuna Published |

    Hi! Is it possible to use this code for per user basis? not only for the admin? I’d love to add this in my future site.

    Hope you can get back to me asap! 🙂


    Btw, this is great!

  151. Tiago Celestino
    Tiago Celestino Published |

    If you use textarea, use it’s:


  152. Mauricio
    Mauricio Published |

    Thank you so much!!!

  153. Creating author profiles with extra fields and exporting that data? | SeekPHP.com
  154. Derek
    Derek Published |

    Aside from requiring the extra custom fields that you add with your code above, after you add your code to display the extra fields and the code to save them, when you goto register a new user, will the extra fields be form elements in the reg form for the user to input right away, or just an after thought for me or them to add to their profile after they register?

    Also, based on when you say “Note that if you want to add more fields, copy that and change twitter to something unique for each additional field. Just make sure you change each instance of twitter.” Does that mean we have to keep the ‘twitter’ name for the custom field, or each custom field would be called whatever it’s for?

  155. Juan
    Juan Published |

    Great post, Justin, it has helped me a lot!!

    Is there anyway of showing a list of authors that have that field filled? Or imagine that the field is a radio type, how could I show a list of authors that have selected one or the other option (just if you have the time to answer)? Thank you again!

    1. Juan
      Juan Published |

      Found, with get_users() using the meta_key and meta_value fields. Thanks again!

  156. Cstom profile fields using gravity forms user registration add-on
  157. Dominor Novus
    Dominor Novus Published |

    Very helpful, thanks. I’ll be using this for a website that displays each author’s Skype status on the authors.php page template. The additional profile field will be used to store the Skype user ID. I agree that there’s a ridiculous amount of potential for additional profile fields, especially if the edit profile page is realized in the front-end allowing complete customization.

  158. Richard
    Richard Published |

    So, I guess this change/addition didn’t find it’s way into version 0.2 of the Members plugin then? I installed the members plugin, and I don’t see anything new about custom profile fields. 🙁

  159. James R
    James R Published |

    Thank You, I am going to use this on a diet site so people can track their weight and see how far they have until they get to their goal weight.

    Do you know of a way where I can have them update say there current weight and it would keep track of all last saves?

    So if they update the weight every 3 days they would end up with a list.

    200 lbs
    198 lbs
    195 lbs

    and so on and so one.

    I would love a way to make this automatic/ish for the end user.

  160. Mike
    Mike Published |

    Reading this gave me a very great idea on my next project. Thank you.

  161. Pat Quintin
    Pat Quintin Published |

    Thanks so much for this helpful article!

    I used this on a site I built for a bike racing team, so the guys could add info from two select lists (racing category and age group). The selections are definitely saved and can be seen in the team list on the front end, but when the user logs in to edit his profile, the previously-set options are not selected and will be lost if the user doesn’t set them again before saving his profile.

    Is there a better way to do this, or do you know of a way to force-select the options in the user profile page?


  162. Save custom field types with this function…? | Q&A System
  163. Nathan
    Nathan Published |

    This is no longer working, would be great if you could update it, Justin!

  164. Rich Helms
    Rich Helms Published |


    I found I had to change the top part to

    value=”ID, ‘twitter’ ) ; ?>”

    I wasn’t getting any values from the WP 3.3 system

  165. Rich Helms
    Rich Helms Published |

    Sorry, the comment system removed part of the code

    echo get_usermeta($user->ID, $metaname )

    in the value startment

  166. Rich Helms
    Rich Helms Published |

    sorry again. The $metaname is from my code

    echo get_usermeta($user->ID, ‘twitter’ )

    That works.

  167. Creating author profiles with extra fields and exporting that data? | Q&A System
  168. Creating author profiles with extra fields and exporting that data? | Q&A System
  169. Chris Silverman
    Chris Silverman Published |

    Thanks, Justin, this was exactly what I needed. Only problem was that I was using a textarea instead of an input field, which broke it. Tiago’s comment above really helped:


    Also, I noticed that update_usermeta has been deprecated since 3.0. The new function seems to be identical, just with an underscore between user and meta:


  170. nikhil
    nikhil Published |

    Really Cool description. Thank you for sharing it.

  171. Chris
    Chris Published |

    So we had a developer create wordpress blog who i believe used this exact code to create profile fields for our users, I am trying to take this now a step further. The two custom fields we have are Location and Program, where the user can indicate where they are and what program they are with. I am trying to create a page that filters on these two fields, so for all the users who have Rome, Italy it will return all the bloggers who have this. Or if someone clicks on a Program title it will filter all the users who have that program name. Can anyone help me get started on how to accomplish this?

    The two fields currently just pull the text:

    Any help would be most appreciated.

  172. Chris
    Chris Published |

    sorry it keeps erasing, tried to surround it with tags

    the_author_meta  ('location', $author   ->post_author);   
    the_author_meta  ('program', $author   -> post_author);
  173. Suzette
    Suzette Published |

    Thank you, thank you, thank you for this. I have been searching the internet for almost a week for this solution for my members listing wordpress site. For someone who doesn’t know much about php, your directions were very clear and easy to follow/ implement. Good Job!!!

  174. Steve
    Steve Published |


    I have learned from your and other websites about how to add custom fields to the wordpress profile page. Is there a way to place them between the “Biographical Info” text box and the “Change password” field? I want to add 7 custom fileds to the profile page, but want them placed in this exact spot. How can I do this? Is this something that may require javascript? Please advise. Thanks in advance!

  175. Denis
    Denis Published |

    Thank you Justin for this great tutorial!
    Also thank’s a lot to Chris Silverman who noticed that update_usermeta has been deprecated since 3.0 and update_user_meta should be used instead.

    Works perfectly with 3.3.1.

    Thank’s again!

  176. Suraj Shakya
    Suraj Shakya Published |


    Your tutorial is really helpful. Currently i’m using the plugin “Cimy User Extra Fields”. But i want the repeating field to add user achievements which had icon and textarea for each achievement.

    Can you help me how to implement it?

    Thanks in advance.

  177. leo
    leo Published |

    thxs man i will use it in future for own site!!!

  178. Natalya
    Natalya Published |


    I am trying to add 2 custom fields to my user profile:

    add_action( 'show_user_profile', 'extra_user_profile_fields' );
    add_action( 'edit_user_profile', 'extra_user_profile_fields' );
    function extra_user_profile_fields( $user ) { ?>
    <textarea rows="5" cols="5" name="notes" id="notes" value="ID ) ); ?>" >
      <option ID ) ); ?>>Private
      <option ID ) ); ?>>Public
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    	update_usermeta( $user_id, 'status', $_POST['status'] );
    	update_usermeta( $user_id, 'notes', $_POST['notes'] );

    for some reason when I click update profile the entered information doesn't stay. However it does work with input type. Could you help me to save the entered information for select and textarea type fields?


  179. Michael Shearer
    Michael Shearer Published |


    I am trying to add a field that I’ve created using your method above. It works fine on the profile page, but I’m trying to integrate it with an idea found on this thread:


    I am not using CIMY extra user fields. The text box for updating the field shows fine but it is not updating. I am wondering if there is an input value I need to use that utilizes the save_extra_user_profile_fields function.

    Any thoughts? Thanks!

  180. Brandon
    Brandon Published |

    This is really useful. Thanks so much!

  181. GB
    GB Published |

    This is exactly what I’m looking for, thanks! I have modified it slightly so that the input field is a custom textarea field instead. It works, given that the data that I save in the user profile shows up on my website. However, once the data is saved in the user profile, what has been entered is no longer visible in the textarea box itself in the WP user profile page.

    Here is my code, any help truly appreciated, thanks!

    /* Adding custom user field */
    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
    	Extra profile information
    			By‌line credit
    				<textarea name="byline" style="width: 500px; height: 200px;" id="byline" value="ID ) ); ?>" class="regular-text" />
    				Please enter a two sentence description of yourself. This will go at the bottom of the emailed notes.
    add_action( 'hybrid_singular-post_after_singular', 'my_author_box', 10 );
  182. Johnny
    Johnny Published |

    I did exactly as Justin Tadlock told me to do in his tutorial. The field can be displayed. But it can’t be saved. Why? The code I put in the file functions.php is as follow:

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
    return false;
    /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    update_usermeta( $user_id, 'usermemo', $_POST['usermemo'] );
    function my_show_extra_profile_fields( $user ) { ?>
    Extra profile information
    usermemo; // textarea_escaped ?>
    <?php }
  183. brasofilo
    brasofilo Published |

    using this code (and creating the respective files) you can fully customize CSS and jQuery of the Profile page:

    add_action( 'admin_print_scripts-profile.php', 'custom_profile_style', 0 );
    add_action( 'admin_print_scripts-user-edit.php', 'custom_profile_style' );
    function custom_profile_style() {
    	wp_register_style( 'custom_profile', get_stylesheet_directory_uri() . '/css/profile.css' );
    	wp_enqueue_style( 'custom_profile' );
    	wp_register_script( 'custom_profile_js', get_stylesheet_directory_uri() . '/js/profile.js' );
    	wp_enqueue_script( 'custom_profile_js' );
  184. Rob Steiner
    Rob Steiner Published |

    No need to c&p each field:

    $v)update_usermeta( $user_id, $k, $v );
  185. matthew w
    matthew w Published |

    2.5 years old, and the code still works like a charm. thanks! justin is a real life saver.

    1. Aalaap Ghag
      Aalaap Ghag Published |

      I was about to post the same thing! 🙂

  186. Monika
    Monika Published |

    yes it works like a charme, but there are some deprecated functions this days


  187. John
    John Published |

    I followed Justin’s instructions exactly and get some author info displayed with posts, including author’s username, avatar, and biographical information, but no Twitter username. Any suggestions?

  188. John
    John Published |

    Figured it out – a css issue. I removed ‘class=”twitter clear”‘ and works great!

  189. Anthony Abraira
    Anthony Abraira Published |

    I found trouble getting the fields to save in the profile. I went ahead and searched a little more on the internets and found this article that pretty much spells out the exacting instructions… save for this:


    update_user_meta( $user_id, 'address', $_POST['address'] );
    update_user_meta( $user_id, 'city', $_POST['city'] );
    update_user_meta( $user_id, 'province', $_POST['province'] );
    update_user_meta( $user_id, 'postalcode', $_POST['postalcode'] );

    the key was changing ‘update_usermeta’ to ‘update_user_meta’

    DISCO! Works like a champ now.

  190. Pierre-Luc
    Pierre-Luc Published |

    What am I doing wrong here because infos are not saved and updated when i update the profile… 🙁 Identification de Rep Code Rep Unique

    <input type="text" name="Code Rep Unique" id="unikrepcode" value="ID ) ); ?>" class="regular-text" />
    				Voici Votre Code Rep Unique.	
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    	update_usermeta( $user_id, 'unikrepcode', $_POST['unikrepcode'] );
  191. ps
    ps Published |

    I would like to add extra field to store Google Maps location code for each user, but when I paste the maps code (<iframe…) , it strips all the code, leaving only plain text. Is there a way to allow html in that field?
    Please help…
    Thanks in advance!

  192. WordPress Core Features, What Would You Like To See?
  193. Aalaap Ghag
    Aalaap Ghag Published |

    Tried 5 different plugins to add simple custom fields like Twitter and Facebook and failed. Finally decided to take things into my own hands, found this, done!

  194. andrés
    andrés Published |

    Hi man, have you released the plugin, or you wont do it?

  195. andy
    andy Published |

    Thanks for this Justin!

    I’m able to create the fields and save the data to the database, but am unable to display on my site(s). I’m using multisite, so I’m guessing that is what is causing the issue, but I’m unsure how to modify the code to display the additional data.

    Does anyone have a suggestion?


  196. Víctor Jurado
    Víctor Jurado Published |

    Hi, your solution is great!, i have a question: Is there any way to get a profile field in automatic to add a custom field with this value for each post created for the author??

  197. Alec Rippberger
    Alec Rippberger Published |

    I might be wrong about this, but I think your solution broke with the last update (3.4.1). Then again, maybe I did something to break it. I’ll keep investigating.

  198. Glen
    Glen Published |

    I’m having the same problem. The input data dissapears after the next page load, rendering the data moot upon another “save.”

    Has anyone found a solution?

  199. Toni
    Toni Published |

    Same problem as Alec and Glen.
    Running wp 3.4.1.

    First try:

    Second try:
    Above suggestion

    Both don’t update.
    I’ll keep researching, but any pro-coder help would be appreciated.


  200. andrés
    andrés Published |

    how can I show the profile in a page? thanks

  201. Louise in Tokyo
    Louise in Tokyo Published |

    Thanks to Anthony Abraira!!!

    the key was changing ‘update_usermeta’ to ‘update_user_meta’

    And Monika

    yes it works like a charme, but there are some deprecated functions this days


  202. Bruce C
    Bruce C Published |

    Thank you very much. I was looking for a plugin that would do this and works well for Wordpress multisites as well, which is what I have.

  203. Bruce C
    Bruce C Published |

    Justin, I decided to work your code into a new plugin that also creates a submenu page, so the Wordpress admin can create a comma delimited list of user fields and each field becomes as a shortcode as well, so those user fields can be displayed anywhere.


  204. Henry
    Henry Published |

    Is it possible to display the extra profile data outside of single.php? For example in the blog footer?

  205. Henry
    Henry Published |

    Just noticed after reading the Codex that the_author_meta function can take an optional second parameter (user ID). Problem solved. Thanks

  206. omid
    omid Published |

    I hope someone can make “adding image to profile field” plugin.
    I already read this http://alextheafrican.wordpress.com/2012/03/10/how-to-add-an-image-field-to-buddypress-extended-profile-fields/

    but couldnt adjust it 🙁

    1. KalenGi
      KalenGi Published |
  207. Slushman
    Slushman Published |

    @Alec, @Glenn, @Toni – I was having the same issue. I noticed that I didn’t have the $user parameter in the function I used to make the profile fields. Once I added that, it started saving. Not sure if that’s your issue or not, but its an easy thing to overlook.

    Your profile field function signature should look like:

    function profile_meta( $user )
    1. Yego
      Yego Published |

      @Slushman hey, am tryna do what you suggested but its not working. could you clarify i cant get to update from the front end.

      would highly apreciate.

  208. Marc
    Marc Published |

    How to make the custom field show up too in bbpress profile page

  209. RSVPMaker 2.7 released, adds login option for events on membership-oriented sites | RSVPMaker WordPress Plugin
  210. Gil
    Gil Published |

    I was wondering if anyone had a chance to get a solution to the file upload option to add photos to the user profile page.
    I see here many comments of people want to add photos to the profile but no answers and no solutions…
    I was also looking all over the web. couldn’t find any solution to adding photos to the user profile page. it’s amazing how necessary it is and no one gives a nice solution to it..

  211. Philip
    Philip Published |

    Is there any way to make one of these fields a hyperlink?
    So when a user fills in the field of their personal blog, it can link to the site?

  212. pankaj
    pankaj Published |

    Thank Justin, nice tutorial. Its working…

    Is there a way to add that same field also on the user register form. basically i need a contact number of every registered user. So i want that field to add on user register form.

  213. Michael
    Michael Published |

    Brilliant! Used for assigning an icon to posts by specific users – and it works perfectly. Thank you very much, Justin Tadlock 🙂

  214. Ian Applegate
    Ian Applegate Published |

    Hi guys

    Is there a way to do this so you can add Buddypress xprofile fields to the WordPress user profile page?



  215. Denis
    Denis Published |

    How can you target a specific location on the user profile page to add your custom profile field? For instance, I don’t want my new custom field to be tacked on to the very bottom of the user profile, I want it as the first item in the “About Yourself” section above the “Biograhical Info” textarea.

  216. Custom profile fields using gravity forms user registration add-on
  217. Zapra Gartiast
    Zapra Gartiast Published |

    Hello there, I need a custom fields to add user level in the post. So the post only show if the user level is have permission to see that..
    What the value I must input in the custom fields?

  218. P36p
    P36p Published |

    Hi Justin, thanks for your tutorial that’s really helpful with building my custom profiles with gravity forms. I just have an issue on displaying some fields conditionnaly like :

    I display those Fields for all (your tutorial)


    if User is ROLE A display additionnaly this field

    and if user is ROLE B display additionnaly this field

    do you have an idea of how I could do that ?

    Thanks in advance for your help !

    1. JD
      JD Published |

      You would need to use current_user_can(). Something like:

      You’d put something like that in your functions.

      1. JD
        JD Published |

        Last try… 😉

        if ( current_user_can( 'manage_options' ) )
             // Code for administrators.
  219. Antonio
    Antonio Published |

    Will you help me?

    I need to put in the user profile: Field Deployable Country, Region and Country Field Deployable Deployable City.

    It is important that when you select Country, appears associated Regions and selecting Region, cities appear associated to the Region

    Thank you very much and I hope your help

  220. Fatih Toprak
    Fatih Toprak Published |

    What a great tutorial 😉 Thanks @justin that is what i want

  221. Clifford
    Clifford Published |

    Maybe it’d be helpful to add one or more of the created fields as a sortable column in the User list ( /wp-admin/users.php ).

  222. Class on 5.2.13
    Class on 5.2.13 at |
  223. WordPress—Add Custom Fields to User Profile Editor » Eve Lurie Blog
  224. Bart De Vuyst
    Bart De Vuyst Published |

    Hi there,

    excellent article, even three years later.

    I get this to work with text fields and radio buttons. Bu how does it work with a field? For example a country select list…

    Any ideas?

    thanks in advance,


  225. John
    John Published |

    Pretty straight-forward, but it doesn’t work for me (not saving).

  226. David Horn
    David Horn Published |

    Just in case this helps someone … I was having trouble getting the information to display in the user settings page in wp-admin, although the information was being saved correctly in the usermeta table.

    It turns out that the fields I created: ‘author-contact-phone’ and ‘author-contact-mobile’ were being stripped of their hyphens, so when I tried to reference them again I needed to reference ‘authorcontactphone’ and ‘authorcontactmobile’ – and that worked a treat.

    Thanks for this Justin, great tutorial.

  227. Steve Marks
    Steve Marks Published |

    Just what I was looking for! Thanks very much 🙂

  228. Daniel Lemes
    Daniel Lemes Published |

    Very useful, thanks. I’m using in a custom author page, and to get fields values i’m using get_userdatabylogin, this way:

    $thisauthor = get_userdatabylogin($author_name);
    echo $curauth->myfield;

    Hope it helps.

  229. Daniel Lemes
    Daniel Lemes Published |

    I had problems to save values from checkbox group, it was only saving a single value. I presume that the best way to save this values is with an array, but i don’t know how to do this. So i’m saving each checkbox value separately:

    $favorito = get_the_author_meta( 'console', $user->ID ); 
    $favorito2 = get_the_author_meta( 'console2', $user->ID );
    <input type="checkbox" name="console" id="Atari 2600" value="Atari 2600" <?php checked( $favorite, 'Atari 2600' ); ?> />Atari 2600
    <input type="checkbox" name="console2" id="Mega Drive" value="Mega Drive" <?php checked( $favorite2, 'Mega Drive' ); ?> />Mega Drive


    update_usermeta( $user_id, 'console', $_POST['console'] );
    update_usermeta( $user_id, 'console2', $_POST['console2'] );

    Probably the lamest solution ever, but it works 😉

  230. Adding an image uploader to the user profile page in WordPress | S2 Web
  231. Rachel Letardis
    Rachel Letardis Published |

    You’re a saviour! I’ve been racking my brains for the last few hours trying to figure out how to add custom user fields and get it to be visible to no avail.

    Using your code as I base, I was able to code up a a members list with custom user profile fields without having to add any more plugins.

    Thank you so much!

  232. Craig Abbott
    Craig Abbott Published |

    Hi Justin

    Awesome tutorial! Got everything working. Though, I was wondering how difficult it would be to create a form input box on the front end that could update the custom field in the back end, and if so how would I go about implementing it.


    1. Jacob
      Jacob Published |

      I’m using Gravity Forms to create frontend forms that update user profile information by creating a custom field group in the plugin Advanced Custom Fields, then by using the same meta names, and using a slightly modified version of the code above, it’s quite easy to add a simple text box user profile field in a Gravity frontend Form and see that same information refresh in the backend of Wordpress as well.

  233. Jacob
    Jacob Published |


    I’m using Gravity Forms to create frontend forms that update user profile information by creating a custom field group in the plugin Advanced Custom Fields, then by using the same meta names, and using a slightly modified version of the code above, it’s quite easy to add a simple text box user profile field in a Gravity frontend Form and see that same information refresh in the backend of Wordpress as well.

    My question though for Justin, like a few others on here, is how would you code a select drop down list? I seem to get close, but I can’t quite figure it out. I’d really appreciate help.

    Thank you for this tutorial

    1. Ian
      Ian Published |


      Would you be kind enough to share said modified code?


  234. Bradley
    Bradley Published |

    I’m using the above method to display user data on the backend profile and it works great but it’s not allowing me to update these extra fields.

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
        Bombshell Fitness Application
                Date the user agreed
                    <input type="text" name="Date-the-user-agreed" id="Date-the-user-agreed" value="ID ) ); ?>" class="regular-text" />
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
        if ( !current_user_can( 'edit_user', $user_id ) )
            return false;
        /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
        update_usermeta( $user_id, 'Date-the-user-agreed', $_POST['Date-the-user-agreed'] );
  235. Bradley
    Bradley Published |

    Sorry I tried to use the pre tag for code. I’ll try again.. sorry for posting twice if this doesn’t work.

    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    function my_show_extra_profile_fields( $user ) { ?>
    <h3>Bombshell Fitness Application</h3>
    <table class="form-table">
            <th><label for="twitter">Date the user agreed</label></th>
                <input type="text" name="Date-the-user-agreed" id="Date-the-user-agreed" value="<?php echo esc_attr( get_the_author_meta( 'Date-the-user-agreed', $user->ID ) ); ?>" class="regular-text" /><br />
                <span class="description"></span>
    <?php }
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    function my_save_extra_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
        return false;
    /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    update_usermeta( $user_id, 'Date-the-user-agreed', $_POST['Date-the-user-agreed'] );
  236. Custom User Fields in Wordpress | Blogs by Jon
  237. Jagan
    Jagan Published |

    Update_postmeta has been depreciated in wordpress 3.6, so it isn’t working.

    So change update_postmeta to update_user_meta for usage in new versions of wordpress.

    The code block above have depreciated code.

  238. Danny
    Danny Published |

    Hey Justin

    Great content on your article that i’m now putting into play on my own site. i have a question though regarding the custom info that i have now stored per user(subscribers only) So we have a point system that we control and each subscriber on our site has a value that we input. how would i display that users point on the page after he has logged in. so if i log in and i have a value of 2 in my custom field then it must show me that value only when I’ve logged in. is that possible ?

    Thanks a million in advance! great article!

  239. geomagas
    geomagas Published |

    Just what I was looking for!

    Good work. Thanks!

  240. Associate Posts with individual user – hide from other members | Question and Answer
  241. Add and display custom profile fields using gravity forms | A1 Web Design Team :: Blog
  242. hamed moodi
    hamed moodi Published |

    Very Useful And Nice


  243. Alex Sarnowski
    Alex Sarnowski Published |

    Awesome tutorial, thank you very much! I ran into a lot of dead end tutorials and this one finally gave me the correct code. Must I suggest adding a few lines of code to check if the user add the “@” symbol themselves, and if not add it automatically. This is what i wrote and am using.

    /* Check if user added “@” symbol, if so save meta as so. If not, add “@”, then re-save the meta */
    $forbiddenchar = ‘@’;
    if(preg_match(“/$forbiddenchar/i”, $user_id))
    update_usermeta( $user_id, ‘twitter’, $_POST[‘twitter’] );
    else {
    update_usermeta( $user_id, ‘twitter’, ‘@’.$_POST[‘twitter’] );

  244. Hugo
    Hugo Published |

    Exactly what I was looking for. For those who want to know how to populate a select field, here how it’s done :

            <th><label for="user_cat">Catégorie</label></th>
                <select name="user_cat">
                    <option value="-1">Select a category ...</option>
                    <?php $user_cat = esc_attr( get_the_author_meta( 'user_cat', $user->ID ) ); ?>
                    <?php foreach ( $categories AS $cat ) : ?>                  
                    <option <?php if($cat->cat_ID == $user_cat){echo 'selected="selected"';} ?> value="<?php echo $cat->cat_ID; ?>"><?php echo $cat->name; ?></option>
                    <?php endforeach; ?>
                </select><br />
                <span class="description">Select a category for user.</span>
  245. Renjith
    Renjith Published |

    Thanks 🙂

  246. Adding and using custom user profile fields - Thechaosz
  247. Henry Wright
    Henry Wright Published |

    You may have already addressed this in the 278 comments so far, but should you be using something like sanitize_text_field() before saving the value to the db?

  248. Bnimbhal
    Bnimbhal Published |


    Thanks a million, i tried this code and work fine for me but having only one issue, all the details are displaying in a single paragraph even I am using .


  249. Ryan
    Ryan Published |

    Can we pull info from the profile data and post it in an HTML file rather than PHP? Reason I ask is:

    I am setting up a gravity forms order form, I used your great tutorial for setting up “Extra Profile Data” and everything works great!

    Now I want to take some of those “Extra Profile Data Fields” and post them in the email notification that comes from gravity forms. It so happens to be that the notifications can be customized but in an HTML manner. Let me know what you think!

  250. John-Henry Ross
    John-Henry Ross Published |


    Thanks for the great article, works like a charm 😀

    I just have a question, does this apply to multisites as well? If you want to register the users with all included custom fields across the network, should you use the functions.php across the network?

  251. Adding and using custom user profile fields
  252. Wordpress - Custom Registration Form Dropdown Field - HelpDesk
  253. How to add this profile field to the profile page? - HelpDesk
  254. talitha
    talitha Published |

    Justin Tadlock

    Q: is this like a user/ member editing or changing their own profile page similar to the old Myspace?

  255. Chris Dill
    Chris Dill Published |

    I used this technique to add a special link to customer “My Account” pages in WooCommerce. It is basically a third party SEO report page, which needs to be password protected. So I created two fields which allows me to manually enter the report link, and the customer can log in to see the report which is linked out on their “My Account” page. Very great solution, thanks for the code!

  256. Dom
    Dom Published |

    Thank a lot buddy!

  257. aimee
    aimee Published |

    Hey Justin

    Stellar work, as always!

    I’m trying to do something a little unusual, perhaps, and I’m hoping you can help me…

    I have a site to which logged-in users can submit content using Gravity Forms. Once the content is submitted and approved by moderators, it then shows on the site.

    Logged-in users are assigned Subscriber status, which means they can read other posts and comment on them, but can’t edit their own or anyone else’s work. There are good reasons for this 🙂

    What I’d really like to be able to do is to add, above each post, a custom meta box which a user, if logged in and its their content, can edit.

    Basically, I want a function which checks if the user is logged in, if they are the author and then, if so, allows them to edit the box. However, for the life of me I can’t figure out how to write that or, more to the point, where to write it and then how/where to call it…

    I’m running WP 4.0.

    [The website’s currently running locally, so I can’t share it, sorry :(]

    I’ve got as far as adding a nice little meta box div into my single.php file, placing it where I want it, and getting it default-filled with content.

    1. Callemann
      Callemann Published |

      Aimee !

      Did you find a solution.

      I have the same issue and can’t figure it out.



  258. Serge
    Serge Published |

    Thanks for the great writeup Justin. Can I also use this to save data from radio buttons?

  259. Associate Posts with individual user - hide from other members - HelpDesk
  260. Vijaya Narayanasamy
    Vijaya Narayanasamy Published |

    Really very helpful.I was looking for this code from past 2 days.Really ur code saved my time.Thanksssssssssss.

  261. Wordpress - Custom Registration Form Dropdown Field - Technology
  262. damien
    damien Published |

    Big up for this tutorial !

  263. Add and Remove fields in Profile page | DL-UAT
  264. Adding Extra Fields to the WordPress User Profile | Solutions for enthusiast and professional programmers
  265. Min Min
    Min Min Published |

    Thanks so much for your code. I have used it on my poetry community site to display roles of our poets, Bronze Poets, moderator and admin……without a plugin!

  266. How to add custom fields in WordPress user profiles | Winfield Little
  267. Brad Dalton
    Brad Dalton Published |

    Thanks for the code Justin.

    Needs updating to update_user_meta

  268. Chris
    Chris Published |

    Thanks for the post Justin

    I was going to use this to save Latitude and Longitude data of a long list of garages, for a client who wants a ‘find your nearest garage’ function. However, because the fields are held as post meta, it may run too slowly. Only one way to find out, and that is to build it and see. Wish me luck!

  269. David Goebel
    David Goebel Published |

    Great tutorial, thank you.

  270. WordPress Tips & Tricks for Developers | Ben Marshall
  271. Alex
    Alex Published |

    Hello @Justin Tadlock

    Nice post you have wrote here. I am wondering how to do one of the following things.

    The user field I added to the profile section of wp-admin is a “Staff Label” field. I then took that field and displayed it in the comments. My code for doing this is follows.


    So first I grab the current user ID by using the comment author’s email. Then I add an extra check to see if the current user has the “staff” custom capability I created. After this, it is all your code except I pass the user ID that I get using the comment author’s email in the 2nd parameter.

    Would it be possible to do one of the following and if so how?

    A: Automatically fill in the field if the field is empty with just “Staff” so there won’t be staff users without a label next to their name.

    B: Use “else” and my if statement to display for “staff” cap and just echo a staff label if field is empty.

    I am thinking second option will be the easiest, but I don’t think I can just use “else”. I think I must check to see if the field is empty and I have no clue how to do this.

    Thanks for any help you’re able to provide.

  272. Alex
    Alex Published |

    Found a solution, thanks.

  273. Gabrielle
    Gabrielle Published |

    Hi, thank you for this code, can you ,please provide some link how to samitize custom user profile fields? I’m using WP API to add settings section & fields, and functions as callbacks to sanitize my fields, but i can’t figure out how to sanitize fields using your code.

    Example: allow user put only url in field custom_user_url.

    Also thanks to this + wp codex i’am able to replace default gravatar for each user with custom url ;p

  274. Dr Masoud
    Dr Masoud Published |

    I want if any user logged in there account see this expect View profile and logout

    link this :

    View Profile

    Test link 1

    Test link 2


    can you help me to do this?

    Thank you

  275. Aggiungere un campo signature al profilo utente | I LIKE WORDPRESS
  276. Soheil
    Soheil Published |

    thanks for your Tutorial .

    can i ask you also for other codes i always need to put them in function.php ?

    i wanna add follow/unfollow in user profile and users posts .

    like this codes follow_text('following_who_user_id', get_current_user_id());

    but they wrote : You need to use the API for that.

    or for this one :

    if($author_id != $current_user_id) {
    echo $userpro_social->follow_text($author_id, $current_user_id);

    they wrote : Use this php code:

    and i donot know where to use the codes.


  277. User Registration Add-on – Gravity Forms Documentation
  278. Ganpat Desai
    Ganpat Desai Published |

    Hello, It is great post. But not showing fields in “add new user page”. You need to add ‘user_new_form’ hook. Here is code add_action( ‘user_new_form’, ‘my_show_extra_profile_fields’ );

  279. Turabali
    Turabali Published |

    Hello @Justin Tadlock and followers,

    Very useful tutorials around here.

    Thanks for helping people like me.

    I have created a user meta field called “location“.

    Which stores location info of user.

    I have many users and their custom posts.

    my problem is ->

    Can i assign this field to every Posts of corresponding user.

    Please help me out to resolve this …

    Thanks and Regards


  280. How to redirect users after login based on wp user meta key? - ExceptionsHub
  281. Creating author profiles with extra fields and exporting that data? My Wordpress Tips
  282. suresh kumar
    suresh kumar Published |

    I am working on a medical reporting site in wordpress, where the requirement is that admin

    can upload a seperate .pdf file to different users’ profile & only the profile owner can download it

  283. Bill Gilmore
    Bill Gilmore Published |

    this saved my bacon thank you so much, ACF plugin allows this but your code works with other code to edit the fields from the front end. I’m a happy developer =]

    thank you

Comments are closed.