Apply filters to specific form

Hi guys,

I need to change the markup of a specific form; I’ve seen this can be achieved with using filters - but what I can’t find anywhere is how to apply this to one specific form, rather than all forms.

I tried something like below but had no luck:

add_filter( 'gform_submit_button', 'form_submit_button', 10, 2 );
    function form_submit_button( $button, $form ) {
        $result = GFAPI::get_form(4);
        if ( $result ) {
            return "<button class='button gform_button' id='gform_submit_button_{$form['id']}'><span>Submit</span></button>";
        }
    }

Thank you

Solved this. For anybody else looking for the answer:

$formID = $form['id'];
// Choose a form ID
if ($formID == 4) {
    return '...';
}

You can add the form id to the end of the filter name like the second example in the usage section of the docs at:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.