This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is experiencing fatal errors like
Uncaught TypeError: Illegal offset type in isset or empty in /wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php:259
on their English version pages after enabling media translation and clicking 'start' for the media translation in WPML.
Solution:
1. We identified that the issue might be related to the Advanced Custom Fields (ACF) plugin, where the theme is calling for an ACF field that contains the ID of an image, which WPML tries to translate.
2. We suggested disabling any caching plugins and server-related cache as a first step to resolve the issue.
If this solution doesn't look relevant to your issue, please open a new support ticket with us.
0% of people find this useful.
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.
This topic is split from https://wpml.org/forums/topic/problems-with-locked-fields-acf-deleted-fields-still-visible-hiding-fields/
Tagged: Documentation request
This topic contains 15 replies, has 2 voices.
Last updated by Laura 1 year, 8 months ago.
Assisted by: Laura.
Author | Posts |
---|---|
November 7, 2023 at 2:13 pm #14747999 | |
lisaH-16 |
Hi Laura, Thank you very much for your answer. I will check this later today! We have a big issue right now, after enabling the media translation. We get fatal errors here after enabling this and clicking on "start" for the media translation. Any possibility to revert this or something like that? Here is an example of some errors: #21 {main} Our pages for our default language are still working but for EN version, all pages get a fatal error. We really looking forward for your help!! Thanks |
November 7, 2023 at 3:55 pm #14749735 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
The error seems related to your theme. What do you have on about-us.php at line 10? |
November 7, 2023 at 4:24 pm #14750123 | |
lisaH-16 |
This is line 10 And this is the template code of image-text-header: <?php if($post_type === 'product') { <section id="" class="image-text-header"> <div class="svg-icon svg-icon--list_item secondary"> <img class="svg-icon--list_item" src="<?php echo get_template_directory_uri() . 'https://cdn.wpml.org/img/icons/Check.svg'; ?>" alt=""> </div> <span class="secondary"><?php the_sub_field( 'keyfact' ); ?></span> </div> <?php endwhile; ?> <?php else : ?> <div class="spacer bg-secondary image-text-spacing"></div> |
November 7, 2023 at 4:28 pm #14750141 | |
lisaH-16 |
I can't imagine that it's because of this file, since our front-page template doesn't use it at all, for example. The version in EN for the start page does not work at all, as on all other pages for EN |
November 7, 2023 at 5:12 pm #14750433 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
I need to ask a second opinion since I've never seen such an issue. |
November 7, 2023 at 5:15 pm #14750499 | |
lisaH-16 |
Oh damn, ok. Is there another option how we can fix this, e.g. reset the media translations? As a plan B? |
November 7, 2023 at 5:31 pm #14750773 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
If the issue happened after activating WPML Media, the only thing I can think of is to disable it via FTP and see if it works. |
November 7, 2023 at 5:32 pm #14750789 | |
lisaH-16 |
No, it happened right before.. |
November 7, 2023 at 5:49 pm #14750863 | |
lisaH-16 |
By mistake, we executed Settings > Media Translation > Start before installing the media translation add on. We then installed it right after that and thought it would solve the problem But I also wonder how it can be that a seemingly critical function can shut down everything |
November 7, 2023 at 5:54 pm #14750885 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
You don't need Media Translation to run the Media duplication process, which in any case runs by default in the background when you install WPML - so you didn't really need to run it, actually. If there is a compatibility issue with your theme (which without further debugging is the primary suspect) the Media duplication process might very well cause an error. |
November 7, 2023 at 6:03 pm #14750961 | |
lisaH-16 |
And what possible sources of error could there be on the theme side? Before we executed the Media Translations via "Start", everything ran smoothly with our theme. The entire content was visible for DE and EN and everything worked, except for 2-3 things that I put in the initial ticket. What would help you to investigate further here? |
November 8, 2023 at 10:00 am #14754647 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
It seems your theme calls for an ACF field, "image", which likely contains the ID of the image attached. When the theme calls for the field, WPML tries to adjust the ID with the translated ones, and it calls the function WPML_Element_Translation->maybe_populate_cache(). If the ID is not in the cache, that explains the error. Please try to disable any cache plugin you may have (I don't see them in the plugin list since you're on a multisite) and also any server-related cache. If it doesn't help, we'll need a copy of the site for further debugging. |
November 8, 2023 at 11:15 am #14755577 | |
lisaH-16 |
We have now reset the entire site to a previous state via backup in order to be able to continue working. But I will keep that in mind, thank you. -- Heading back to the initial ticket, when we would like to show different images on specific pages / fields, what do we have to do to achieve this without arriving at the same error? Is it enough to install the media translation add on (without restarting the media translation via "start" in the wpml settings)? Our aim is to only show different images on a few places on the page. So not everything should be duplicated. In addition, we would only like to make the changes within the editing of the page and not in the wpml translation editor. (Screenshot attached) For URLs it worked when setting the translation option to not translate. So for images it's not possible like this and only works with the media add on? |
November 8, 2023 at 11:58 am #14756143 | |
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Yes, it's enough to install Media translation, but you can't edit the image in the the WordPress editor, you need to do it in WPML > Media Translation. Please refer to our documentation https://wpml.org/documentation/getting-started-guide/media-translation/ If you still have question about translating Media, please open a new ticket. As I've told you, our policy is one issue per ticket and we're going to only address the Uncaught TypeError here, if you wish to solve it. |
November 8, 2023 at 12:28 pm #14756347 | |
lisaH-16 |
Ok, thank you. Then you can close the ticket and if we come back to it, we will open it again if possible. |