Resolved
Reported for: Advanced Custom Fields Multilingual 1.9.0
Resolved in: 1.9.3
Overview of the issue
After updating to Advanced Custom Fields Multilingual 1.9.0, you may notice an increase in the number of queries and numerous slow queries.
So far, this situation seems to be exclusively related to themes with ACF fields locally stored in /acf-json/ folders.
Workaround
Our developers are working on it. In the meantime, you can apply the following workaround:
- Make a full backup of your site before proceeding.
- If you are using ACFML 1.9.3 or older, in your functions.php file add this line:
remove_filter( 'acf/prepare_fields_for_import', [ '\ACFML\Tools\Local', 'syncTranslationPreferences' ] );
- If you are using ACFML 1.9.4 or later, in wp-config.php define constant:
define( 'ACFML_SCAN_LOCAL_FIELDS', false );
Hi,
We faced with this problem. And made temporary fix by your recommendation.
Waiting on the next Update of this addon with built-in fix.
Thanks!
We are glad to know it helped, Alex.
We will keep you posted once we have a new release.
Regards
Version 1.9.2 does not totally fix the problem.
$preference is often set as (int) 0 and will be considere as empty.
It will update the value at every refresh even if the value is the same.
file class-wpml-acf-field-settings.php:
private function maybe_set_new_preference( $setting_index, $field, $preference ) {
if ( empty( $this->translation_management->settings[ $setting_index ][ $field ] )
|| $this->translation_management->settings[ $setting_index ][ $field ] !== $preference
) {
should be
private function maybe_set_new_preference( $setting_index, $field, $preference ) {
if ( !isset( $this->translation_management->settings[ $setting_index ][ $field ] )
|| $this->translation_management->settings[ $setting_index ][ $field ] !== $preference
) {
Regards
Thank you very much for your report, Jonathan. I’ve shared your findings with our developers.
I’ll keep updated here.
We applied the fix mentioned here, including what Jonathan mentions here but it doesn’t seem to improve the situation.
The issue is very much visible when editing a page with the query monitor plugin enabled.
The caller WPML_Term_Query_Filter->get_terms triggers still over 11000 selects in our case.
I have another observation to add here:
We use Ultimate Addons for Gutenberg (UAG) on our site. When disabling that plugin, the entire issue seems to be solved at the page editing level.
Not sure how that is related but may that could be helpful for WPML developers.
With very best regards,
Henri
Thank you very much for your report, Henri.
I wouldn’t say this other situation is related to ACFML but to an interaction between Gutenberg Blocks – Ultimate Addons for Gutenberg and our core. I checked in our archives and we don’t have other reports so far.
Could you please continue in the ticket you have already opened? He will escalate it once he has all the needed information.
Thanks again for your help.
One more observation, I hope this is not off-topic. The issue with Ultimate Addons for Gutenberg (UAG) is mentioned here https://wordpress.org/support/topic/uag-wpml-problem-queries/
When I go roll back to UAG version 1.17.0 the issue is gone!
Henri
The same issue still persist in 1.9.3. TTFB is around 2s without workaround and 100ms when add_filter line is commented out. Is there any hope for a fix in the next version?
Thank you for your report Sergei. Could you please open a ticket in our support forum as we need to investigate it further?
Regards
Looks like this in combination with the latest WMPL v4.5.0. The ACFML v1.9.1 with v4.4.12 was working good…
Hello there,
So far we don’t have reports associated to WPML 4.5.0. It would be great if you can open a ticket in our support forum so we can investigate it better.
Thank you for your help.
Hey WPML Team,
I just want to inform, that the behaviour is also in version 1.9.3 present.
Especially if the system is using a large ACF configuration (around 490 fields defined) & json files.
Reference to thread Split: ACFML 1.9.1 huge problem is the speed of the site.
Have a nice day!
Thank you for your report, Kristian. I’ve already shared it with our devs but it would be nice if you update your ticket as well.
Regards
Hey @Andrés,
thank you for reach out your devs with this information. Thats all what I wanted.
I haven’t (and will not) open a ticket. All information are already here. So I’ll be waiting for the final fix 😉
Thanks Kristian. Unfortunately, we need a site’s copy to check why it is not working as it should be fixed after the last update.
Hello Andrés,
it is not possible and not necessary at the moment.
I know this is your normal way of providing support.
With this hotfix 👆 the performance is back to normal 👍.
Thank you for caring, Cheers.