The function “gform_add_meta()” adds the metadata associated with an entry in the Entry Meta table. The data will be serialized.


gform_add_meta( $entry_id, $meta_key, $meta_value, $form_id = null );


  • $entry_id integer

    The ID of the entry.

  • $meta_key string

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

  • $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. Optional (saves extra query if passed when creating the metadata).


This example inserts a value for a new meta key.

//inserts "This is test data" for the meta key "my_test_key" for entry id 14 for form id 1.
gform_add_meta(14, 'my_test_key', 'This is test data.', 1);

Source Code

This function is located in forms_model.php