Disable GFML gform_pre_render callback

Bypass processing forms with Gravity Forms Multilingual when pulling results for Populate Anything via AJAX.

The reason for this is due to the ‘gform_pre_render’ method in Gravity_Forms_Multilingual using a runtime cache to cache all forms which interferes with Populate Anything.

Instructions

  1. https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
  2. Update the $form_ids_to_skip_gfml variable accordingly.

Code

Filename: gppa-disable-gfml-pre-render-callback.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
 * Gravity Perks // Populate Anything // Disable GFML gform_pre_render callback
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 *
 * Bypass processing forms with Gravity Forms Multilingual when pulling results for Populate Anything via AJAX.
 *
 * The reason for this is due to the 'gform_pre_render' method in Gravity_Forms_Multilingual using a runtime cache to
 * cache all forms which interferes with Populate Anything.
 *
 * Instructions:
 *  1. https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
 *  2. Update the $form_ids_to_skip_gfml variable accordingly.
 */
add_action( 'init', function () {

	// Update the form IDs below
	$form_ids_to_skip_gfml = array( 123, 456 );

	if ( ! isset( $GLOBALS['wpml_gfml_tm_api'] ) || ! wp_doing_ajax() ) {
		return;
	}

	if ( ! function_exists( 'gp_populate_anything' ) || ! function_exists( 'rgar' ) ) {
		return;
	}

	if ( rgar( $_REQUEST, 'action' ) !== 'gppa_get_batch_field_html' ) {
		return;
	}

	$data = gp_populate_anything()::maybe_decode_json( WP_REST_Server::get_raw_data() );

	if ( ! in_array( rgar( $data, 'form-id' ), $form_ids_to_skip_gfml ) ) {
		return;
	}

	remove_filter( 'gform_pre_render', array( $GLOBALS['wpml_gfml_tm_api'], 'gform_pre_render' ) );
	remove_filter( 'gform_merge_tag_filter', array( $GLOBALS['wpml_gfml_tm_api'], 'gform_merge_tag_filter' ) );

} );

Comments

  1. Sjoerd
    Sjoerd October 1, 2025 at 4:16 am

    By using this code, loading via Ajax does indeed work again. However, because of this, the translation in the English form (the options true populate everything) is not loaded, only the default language (Dutch).

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff October 1, 2025 at 5:17 am

      Hi Sjoerd,

      Can you please submit a ticket for this via our support form so we can have a closer look at your setup and assist you with the issue?

      Best,

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.