Updates the meta value of the specified meta key in the Entry Meta table. If the specified meta key does not exist, it will be created.


gform_update_meta( $entry_id, $meta_key, $meta_value );


  • $entry_id integer

    The ID of the entry.

  • $meta_key string

    The meta key of the meta value you wish to update.

  • $meta_value string

    The value to be set as the new value for the specified meta key.

  • $form_id integer

    The form ID of the entry. This parameter is optional (including it removes the need to perform an extra query, if passed when creating the metadata). If it is not included, the $form_id parameter is set to null.


This example sets a meta value for the returned confirmation value from a call to a fictional API on post submission.

add_action( 'gform_after_submission', 'send_to_api' );
function send_to_api( $entry ) {

    // prepare entry details for third party API
    $lead_details = array( 'id' => $entry['id'], 'first_name' => $entry[1], 'last_name' => $entry[2] );

    // send to the third party API
    $response = process_lead( $lead_details );

    // add response value to entry meta
    gform_update_meta( $entry['id'], 'api_response', $response );


Source Code

This function is located in forms_model.php