How do I create an Edit Profile page for users on the frontend with custom fields using Wordpress?

Example Fields:

Image Upload Field

Text Field


And how can a user can save these fields?



1 Answer 1


This is a pretty big thing to ask but basically you go:

Add extra user fields using the code from this answer: Extra User Fields

Change them with a custom template for the user:

/* Get user info. */
global $current_user, $wp_roles;

Now you have the logged in user data which you can then alter. Create fields for the user to change and fill them with the current info e.g.

<input name="first_name" type="text" id="first_name" value="<?php the_author_meta( 'first_name', $current_user->ID ); ?>" />

Then save your data: First check if empty and then overwrite the data.

 if ( ! empty( $_POST['first_name'] ) )
    update_user_meta( $current_user->ID, 'first_name', sanitize_text_field( $_POST['first_name'] ) );

Then redirect the user if saved:

 /* Redirect so the page will show updated info.*/
if ( count( $error ) == 0 ) {
    //action hook for plugins and extra fields saving
    do_action('edit_user_profile_update', $current_user->ID);
    $location = get_user_meta( $current_user->ID, 'user_location', true );
    wp_safe_redirect( get_bloginfo('url') . str_replace( ' ','-', $location ) );

It works this way. I did it in the exact same way.

  • Thanks . Are these changes on the admin panel ? Feb 14, 2018 at 10:52
  • @Interactive - could you explain the redirect with showing updated info a little more? I've got this working except after form submit the page shows the old info in the form fields. If I refresh the page then the new info shows. The user is being updated when I check on the admin side. Thanks! Oct 15, 2018 at 17:07
  • I left several security fixes and clarified the linked code was a WPSE answer not a plugin recommendation.
    – Tom J Nowell
    Mar 28, 2022 at 15:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.