WordPress Hacks - adding additional User Fields
I’m rewriting most of WordPress on another site. One of the things I’m finding with WordPress is that all of the functionality is very robust as long as it’s outside of the Admin panel. For ResortPub, I’m looking to make the experience for the blogger as fun as for the reader. The Administration of Wordpress is just not fun. Basics such as customizing the style of the panel and adding additional Author fields can be frustrating. So… I spent some late nights following the code and found the hack!
If you’d like to add some additional User Fields, there are 4 files that you need to edit. In this example, I want to add a field for the user to put an image of themselves so that I can put it on each of their posts. I’m calling the field ‘imageurl’.
- Registration-functions.php, ~line 98. This will add the field to the user metatable data:
update_usermeta( $user_id, 'imageurl', $imageurl ); - Admin-functions.php, ~line 391. This will ensure that the file has an http://
path.if (isset ($_POST['imageurl'])) {
$user->imageurl = wp_specialchars(trim($_POST['imageurl']));
$user->imageurl = preg_match(’/^(https?|ftps?|mailto|news|gopher):/is’, $user->imageurl) ? $user->imageurl : ‘http://’.$user->imageurl;
} - Profile.php, ~line 89. Add the field to the Profile Page.
- user-edit.php, ~line 154. Adds the field to the User Edit page.
Happy Wordpress hacking!


Douglas Karr