Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are experiencing 504 Gateway Timeouts and significant performance degradation due to increased internal calls to

get_field_groups_by_object_type

after updating WPML and ACF Pro plugins. This issue is linked to how ACFML handles field group translations, especially during REST API requests.
Solution:
We recommend using the

acfml_should_translate_acf_entity

filter introduced in ACFML version 2.1.4 to selectively disable translation logic during REST API requests. Here is how you can implement it:

add_action( 'rest_api_init', function() {
    if ( wp_is_serving_rest_request() ) {
        add_filter( 'acfml_should_translate_acf_entity', '__return_false' );
    }
}, 5 );

It is advisable to add this snippet in a Must-Use plugin for optimal performance.
For more details, refer to the official documentation: ACFML filter documentation, and the release notes: ACFML 2.1.4 release.

If this solution does not resolve your issue or seems outdated, please check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket for further assistance.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 3 replies, has 1 voice.

Last updated by Bruno Kos 1 month ago.

Assisted by: Bruno Kos.

Author Posts
April 17, 2025 at 10:32 pm #16945942

virginiaK

Background of the issue:
We’ve been encountering build challenges related to 504 Gateway Timeouts. After reviewing PHP slow logs, our hosting provider, Pantheon, has indicated that the issue appears to be at the application level, potentially causing performance degradation.

There were noticeable increases in response time with our build with queries that take upwards of 12 seconds when previously under 3 seconds. Pantheon’s investigation led to a noticeable increase of internal calls to get_field_groups_by_object_type from 329 to previous items of 1653. After investigating further into the situation with New Relic, we’re seeing large performance swings, and large differences in the performance monitoring (like the #load_textdomain and the acf_get_field_groups having way more things it’s iterating).

Below are Plugin versions, test env of WordPress instance and also WPML debug log outputs. Please let us know if any additional information is necessary.

Version without issues:
Test URL: hidden link
Advanced Custom Fields PRO: Version 6.3.4
WPML Multilingual CMS: Version 4.6.11

Version with issues:
Test URL: hidden link
Advanced Custom Fields PRO: Version 6.3.12
WPML Multilingual CMS: Version 4.7.2

Symptoms:
Increased query time, 504 timeouts, increased internal calls to get_field_groups_by_object_type from 329 to 1653.

Questions:
Any suggestions on what the issue could be?

One concern we have is that we had to revert the upgrade from version 4.7.2 back down to 4.6.11 and upgraded it again without reverting our database. Could this possibly have corrupted our content in that WPML upgrade and regress on the same content, or how could we know if we had?

April 18, 2025 at 5:09 pm #16947871

virginiaK

We’ve implemented a temporary workaround that appears to be effective. Could you please confirm whether this issue originates from the WPML code? (refer to screenshot attachment)

Screenshot 2025-04-18 at 12.13.50 PM.png
April 21, 2025 at 7:15 pm #16952658

virginiaK

We just wanted to link a previous ticket we filed last year regarding performance as well. https://wpml.org/forums/topic/major-performance-regressions-rom-4-6-3-to-4-6-11-in-rest-api-response-times

April 23, 2025 at 6:08 am #16957873

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Apologies for the delay in getting back to you — with the Easter holiday, most of our team was away, which slowed down our response time.

The slowdown was tied to how ACFML handles field group translations, particularly during REST API requests. After the update, internal calls to `get_field_groups_by_object_type` jumped which directly contributed to the 504 timeouts and long load times you were seeing.

To fix this, we introduced a filter in ACFML version 2.1.4 — `acfml_should_translate_acf_entity`. This allows us to selectively disable translation logic.

Here’s the official documentation for that filter:
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/acf-multilingual-acfml-constants-and-hooks-reference/#acfml_should_translate_acf_entity
And the release it was introduced in:
https://wpml.org/version/acfml-2-1-4/

So yes, you can continue using that filter as you did already:

add_action( 'rest_api_init', function() {
    if ( wp_is_serving_rest_request() ) {
        add_filter( 'acfml_should_translate_acf_entity', '__return_false' );
    }
}, 5 );

It's recommended to add the snippet in a Must-Use plugin.