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: Bug
This topic contains 24 replies, has 3 voices.
Last updated by Shekhar Bhandari 1 year, 7 months ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
April 30, 2023 at 10:50 pm #13563541 | |
Stephen Merriman |
I am developing a site with WPML and ACFML on WP Engine, and have an ACF image / relationship field on a category, set to 'Same fields across languages'. I edit the category in English, upload an image, and select some posts. These display correctly for English on the front-end. If I visit the admin page for a French translation, the image and relationship field are blank. They also do not show up on the front-end. I then go into the WP Engine page in the backend, and click Clear All Caches. Now when I revisit the admin page, or the front-end, the fields show up correctly for the French version. It appears WPML is not correcting clearing term caches for translated languages when a term is saved. |
May 2, 2023 at 9:25 am #13568953 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, Thank you for contacting WPML support! hidden link On this sandbox, can you try reproducing this issue with one simple field/page? And if you see the issue, can you record a video using tool such as hidden link to show it? If it doesn't happen here and is only related to WP Engine caching, could you provide us with a staging site where we could check this issue ourselves? But having hidden link video would also help us to understand the issue completely. Regards, |
May 5, 2023 at 2:21 am #13590553 | |
Stephen Merriman |
Apologies for the delay - have been isolating the problem as much as possible. It can't be replicated on your staging site since you don't have object caching enabled. Here is a video of what happens on a brand new install on WP Engine (I could share access, but hopefully unnecessary based on my video / description below): hidden link - I create a category, and translate it to French. It appears all of this comes down to the fact you are performing direct SQL queries (in this case in the sync_custom_field function in the WPML_Sync_Term_Meta_Action class) - after that there's a line that calls wp_cache_init, but the term cache is never actually cleared, so everything breaks on sites like WP Engine which use a persistent object cache. May not just be term caches too, not sure what else is affected if there is similar code elsewhere. |
May 5, 2023 at 1:01 pm #13594625 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, Does it work if you the group to the excluded (non cacheable) terms (WPML_Cache_Terms_Per_Lang ?) So something in these lines, based on your setup: Or try this also? All these cases were related to the same function, so there is a possibility the same issue is happening on your website as well. Let us know if any of these solutions worked. Regards, |
May 9, 2023 at 9:53 pm #13617665 | |
Stephen Merriman |
I tried disabling wp_cache_set in class-wpml-cache-terms-per-lang.php, and flushed the cache, but the problem still exists, so that's not the cause / solution. |
May 9, 2023 at 10:00 pm #13617673 | |
Stephen Merriman |
Note that I can replicate a similar issue that doesn't rely on the ACFML / ACF plugin at all - still requires WP Engine caching: - load the admin page for both an English category Debugging shows that when the wp_update_term function tests for a duplicate slug, it calls get_term_by('slug','english-slug','category'), but the bad cache generated by the second tab load will return the french term, which has a different slug, throwing an error. In both cases, the caching seems very broken. |
May 10, 2023 at 6:28 am #13618533 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, If you are testing this in 2 browser tabs and switching the language there it will not work. We store the language in a cookie, so if you open the 2nd language, the cookie is overwritten and the cache is updated. Regards, |
May 10, 2023 at 8:40 pm #13626607 | |
Stephen Merriman |
OK. But that does not help resolve the original issue. |
May 11, 2023 at 9:00 am #13628363 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, This is escalated to our 2nd tier team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you. Regards, |
May 16, 2023 at 1:23 pm #13656787 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, We tested with WP LiteSpeed plugin + Memcached (enabled the wp-admin caching) and Redis Object Cache plugin + Redis caching, but we can't replicate the issue. It works fine with both object caching. Can you provide us WP Engine staging site with caching enabled where we can see this? I marked your next reply as private so that you can safely add credentials. Regards, |
May 17, 2023 at 6:21 am #13660605 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Escalated to 2nd Tier |
May 18, 2023 at 10:04 am #13670935 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, Can you try the following? Edit \plugins\sitepress-multilingual-cms\classes\utilities\class-wpml-wp-cache.php. On line 108 replace: private function get_keys() { $found = false; $keys = wp_cache_get( self::KEYS, $this->group, false, $found ); if ( $found && is_array( $keys ) ) { return $keys; } return []; } with: private function get_keys() { $found = false; $keys = wp_cache_get( self::KEYS, $this->group, false, $found ); if ( $found && is_array( $keys ) ) { return $keys; } else if (!$found && !empty($keys) && is_array($keys)) { return $keys; } return []; } It seems the problem is coming from WP Engine caching and we will try to connect with them. Regards, |
May 21, 2023 at 9:28 pm #13685511 | |
Stephen Merriman |
I'm still experiencing the same issue with that update. |
May 22, 2023 at 6:37 am #13686439 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, Can you tell us if this doesn't work on hidden link or some other site? Regards, |
May 22, 2023 at 9:27 pm #13693897 | |
Stephen Merriman |
Yes, that code change was uploaded to that site (and is still in place). |