Title: Update User Meta Fields
Last modified: January 12, 2022

---

# Update User Meta Fields

 *  Resolved [DestinyKing](https://wordpress.org/support/users/destinyking/)
 * (@destinyking)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/update-user-meta-fields/)
 * I have been trying to get this coding snippet up and running and have hit a wall.
   Any suggestions will be appreciated!
 *     ```
       function wpf_dev_process_complete( $fields, $entry, $form_data, $entry_id ) {
   
           $form_id = 2819; // Change form ID
           $user_id = get_current_user_id();
           // Optional, you can limit to specific forms. Below, we restrict output to
           if ( absint( $form_data['id'] ) !== 2819 ) {
               return;
           }
   
           // Update user object with new field values
           $updated_values = array(
       		'ID'($user_id),
       		'user_email'($fields[5]['value']),
       		'test'($fields [4] ['value'])
           );
   
           // Update user
       	update_user_meta($updated_values);
   
           // get all the meta data of the user
           $user_data = get_user_meta($user_id, 'test');
   
   
       }
       ```
   
 * I have added the form id accordingly. This is a test form so I have two total
   fields and email one (field id #5) and a text field called Test (field id #4).
 * I am using Advanced Custom Fields to add a custom text field called Test.
 * Right now I want it to pull up the logged-in user ID which is what it is doing
   but when the user submits the form it does not show a confirmation update saying
   the default “Thanks for contacting us! We will be in touch with you shortly.”
 * It also does not update the meta field ‘test’ on the user profile. Any suggestions
   would be GREATLY appreciated!
 * The overall goal is to allow the logged-in user to update a form that will then
   update their unique profile fields with Advance Custom Fields.
    -  This topic was modified 4 years, 5 months ago by [DestinyKing](https://wordpress.org/support/users/destinyking/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Vijay Hardaha](https://wordpress.org/support/users/vijayhardaha/)
 * (@vijayhardaha)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/update-user-meta-fields/#post-15246767)
 *     ```
       // Update user object with new field values
       $updated_values = array(
         'ID'($user_id),
         'user_email'($fields[5]['value']),
         'test'($fields [4] ['value'])
       );
   
       // Update user
       update_user_meta($updated_values);
       ```
   
 * This part in the code is wrong.
 * for email update you need `wp_update_user` function. Example [https://wordpress.stackexchange.com/a/45211](https://wordpress.stackexchange.com/a/45211),
   WP Documentation [https://developer.wordpress.org/reference/functions/wp_update_user/](https://developer.wordpress.org/reference/functions/wp_update_user/)
 * and for meta field update you need `update_user_meta` that requires 3 params(
   ID, key, value). WP Documentation [https://developer.wordpress.org/reference/functions/update_user_meta/](https://developer.wordpress.org/reference/functions/update_user_meta/)
 *  [Prashant Rai](https://wordpress.org/support/users/prashantrai/)
 * (@prashantrai)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/update-user-meta-fields/#post-15253570)
 * Hey [@destinyking](https://wordpress.org/support/users/destinyking/),
 * We’d be happy to help!
 * The code you’ve shared involves a paid version feature. If you have an active
   license subscription with us, could you please submit a support ticket through
   the WPForms account dashboard when you have a chance?
 * From there, our support team will be able to take a closer look at your request.
 * Kindly,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Update User Meta Fields’ is closed to new replies.

 * ![](https://ps.w.org/wpforms-lite/assets/icon.svg?rev=3254748)
 * [WPForms - Easy Form Builder for WordPress - Contact Forms, Payment Forms, Surveys, & More](https://wordpress.org/plugins/wpforms-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpforms-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpforms-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/wpforms-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpforms-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpforms-lite/reviews/)

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)

 * 2 replies
 * 3 participants
 * Last reply from: [Prashant Rai](https://wordpress.org/support/users/prashantrai/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/update-user-meta-fields/#post-15253570)
 * Status: resolved