Using Gravity Forms ‘gform_pre_submission_filter’ PHP action

The gform_pre_submission_filter is a Gravity Forms filter that allows you to manipulate the Form Object after form validation, but before notifications are sent and the entry is stored.


To apply the filter 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 (e.g., gform_pre_submission_filter_5):

add_filter('gform_pre_submission_filter_5', 'pre_submission_filter');


  • $form (Form Object) – The form currently being processed.

More information

See Gravity Forms Docs: gform_pre_submission_filter


Dynamically populate a checkbox field with a list of published posts

This example populates a checkbox field with a list of published posts. Update the ‘221’ to the ID of your form and replace 3 with your checkbox field ID.

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) {
        $field_id = 3;
        if ($field->id != $field_id) {

        $posts = get_posts('numberposts=-1&post_status=publish');
        $input_id = 1;
        foreach ($posts as $post) {
            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;

Place this code in the functions.php file of your active theme.