Gform after submission


This action hook is executed at the end of the submission process (after form validation, notification, and entry creation). Use this hook to perform actions after the entry has been created (i.e. feed data to third party applications). The Entry Object is available to this hook and contains all submitted values.


Applies to all forms

add_action("gform_after_submission", "after_submission", 10, 2);

Applies to a specific form. In this case, form Id 5

add_action("gform_after_submission_5", "after_submission", 10, 2);



(Entry Object) The entry that was just created.


(Form Object) The current form.

Example 1

This example uses the gform_after_submission hook to change the post content, adding values from submitted fields, including an image field.

add_action("gform_after_submission", "set_post_content", 10, 2);
function set_post_content($entry, $form){

    //getting post
    $post = get_post($entry["post_id"]);

    //changing post content
    $post->post_content = "Blender Version:" . $entry[7] . "<br/> <img src='" . $entry[8] . "'> <br/> <br/> " . $entry[13] . " <br/> <img src='" . $entry[5] . "'>";

    //updating post

Example 2

This example demonstrates a simple approach to posting submitted entry data to a third party application:

add_action('gform_after_submission', 'post_to_third_party', 10, 2);
function post_to_third_party($entry, $form) {
    $post_url = '';
    $body = array(
        'first_name' => $entry['1.3'], 
        'last_name' => $entry['1.6'], 
        'message' => $entry['3']
    $request = new WP_Http();
    $response = $request->post($post_url, array('body' => $body));


This code should be placed in the functions.php file of your active theme.

Source Code

This action hook is located in form_display.php

Search the Documentation