gpsa_load_form_via_ajax
Description
Filter to determine if forms should be loaded via AJAX.
Usage
add_filter( 'gpsa_load_form_via_ajax', 'my_custom_function' );
Apply only when on a specific Post.
add_filter( 'gpsa_load_form_via_ajax_{post_id}', 'my_custom_function' );
Parameters
load_with_ajax bool
Whether to load form via AJAX. Default false.
form_id int
The Gravity Form ID
post_id int
The post ID
args mixed
Since
This filter is available since Gravity Forms Submit to Access 1.0.0.
Examples
Load forms with AJAX only if in the context of a Block or Shortcode.
add_filter( 'gpsa_load_form_via_ajax', 'maybe_load_forms_via_ajax', 10, 4 );
function maybe_load_forms_via_ajax( $load_via_ajax, $form_id, $post_id, $args ) {
switch ( $args['context'] ) {
case 'block':
case 'shortcode':
return true;
default:
return false;
}
}