This filter is executed after form validation, but before any notifications are sent and the entry is stored. This filter can be used to manipulate the Form Object prior to sending notifications.


The following would apply the function to all forms.

add_filter( 'gform_pre_submission_filter', 'pre_submission_filter' );

To target a specific form append the form id to the hook name. (format: gform_pre_submission_filter_FORMID)

add_filter( 'gform_pre_submission_filter_5', 'pre_submission_filter' );


  • $form Form Object

    The form currently being processed.


The following example dynamically populates a checkbox field with a list of published posts

//NOTE: update the '221' to the ID of your form
add_filter( 'gform_pre_render_221', 'populate_checkbox' );
add_filter( 'gform_pre_validation_221', 'populate_checkbox' );
add_filter( 'gform_pre_submission_filter_221', 'populate_checkbox' );
add_filter( 'gform_admin_pre_render_221', 'populate_checkbox' );
function populate_checkbox( $form ) {

    foreach( $form['fields'] as &$field )  {

        //NOTE: replace 3 with your checkbox field id
        $field_id = 3;
        if ( $field->id != $field_id ) {

        // you can add additional parameters here to alter the posts that are retrieved
        // more info: [](
        $posts = get_posts( 'numberposts=-1&post_status=publish' );

        $input_id = 1;
        foreach( $posts as $post ) {

            //skipping index that are multiples of 10 (multiples of 10 create problems as the input IDs)
            if ( $input_id % 10 == 0 ) {

            $choices[] = array( 'text' => $post->post_title, 'value' => $post->post_title );
            $inputs[] = array( 'label' => $post->post_title, 'id' => "{$field_id}.{$input_id}" );


        $field->choices = $choices;
        $field->inputs = $inputs;


    return $form;


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

Source Code

This filter is located in GFFormDisplay::process_form() in form_display.php