Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to change the value of a gravity form entry after the entry is already created

Writer Olivia Zamora

I have a hidden gravity form field that needs to be given a value after the entry was already created and the value needs to show in the form entries in the backend of WordPress.

I think I might be on the right track with this:

add_action('gform_after_submission_8', 'set_job_num', 10, 3);
function set_job_num($post_id, $entry, $form){ $post = get_post($post_id); //Do something here to find and update field ID 57 for form ID 8
{

I just need to know how to find the field I'm looking for and update the post with the new field value.

Thank you!

1 Answer

Solution:

add_action('gform_after_submission_8', 'set_job_num', 10, 3); // The 8 is the ID of the form
function set_job_num($entry, $form){ $updated_entry = GFAPI::get_entry( $entry['id'] ); // ID of entry we want to update $field = '57'; // ID of field we want to update $updated_entry[$field] = 'New Value'; // The new value $updated = GFAPI::update_entry( $updated_entry );
{

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.