• I’m trying to add custom fields to the WP user profile page. These fields need to be pre-filled with data I have already obtained from when the user signed up that is located in the usermeta table, but the user can edit this data if they choose. I’m just wondering how I achieve this, I have researched but found only basic tutorials on adding things such as more social media options to the profile page.

    Thank you for your help.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Look through /wp-admin/user-edit.php. There are several actions that fire at various points in the profile page output. Pick one that makes sense for where you want your fields to appear. Hook that action.

    In your action callback output the HTML desired. You can get the current values from user meta with get_user_meta().

    You also need to hook the action ‘personal_options_update’ where your callback can pull the form field value from $_POST and store it where ever it belongs. After the input is validated and sanitized of course.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding custom fields to the profile page – extracting from database’ is closed to new replies.