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.
Our next available supporter will start replying to tickets in about 6.30 hours from now. Thank you for your understanding.
Tagged: Exception
This topic contains 29 replies, has 2 voices.
Last updated by Bruno Kos 5 months, 2 weeks ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
May 29, 2024 at 8:02 am #15682007 | |
arnoP-3 |
It's weird, because the post you edited is 702582, but hidden link is post 702583. However, hidden link is post 66518 ! (at least that's what I see if I hover over "Edit activity" the WordPress toolbar) Then I went to hidden link and that's where your edited header is. That's post 702582. This URL should not exist but I have seen a similar duplicate before: /rigi-2/ (a long time ago, before the current problem). I was never able to delete it. I did another test and went to hidden link to change the header "Corvatsch: Fragen und Antworten WPML". While I was publishing that change, I noticed that the URL of the post changed from hidden link to hidden link ! So WPML created a duplicate again! I guess the problem we are researching has been present for a long time and it's also what caused the Rigi duplicate a long time ago. Something inside WPML is triggering it to mix up the language versions, and everything including editing a post is getting messy. Perhaps the database shows what happened? It's strange that this wasn't a practical problem until after the last updates. Until then, the backend only showed English posts, and only German posts when switching language, and the frontend was fine too. |
May 29, 2024 at 1:38 pm #15684163 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We believe this may be a matter of workflow but are not entirely sure. Some of the suggestions: 1. **Avoid Manually Changing the URL**: Do not manually change the post ID in the URL to edit the post. This can cause the post to become disconnected from its translated version. 2. **Ensure Correct Language Editing**: If you must change the URL, make sure you also edit the correct language for the post ID in the URL. Changing the last two characters to 'de' without proper context will create duplicates and cause issues with the language dropdown and URLs. However given that this is the case with many posts as you reported, do you have any steps to reproduce this? Our 2nd tier believes that this would be the cause of it though: "If I take the URL hidden link and change the last two characters to 'de', the Language dropdown shows German." By altering the URL from hidden link to change the last two characters to 'de', the Language dropdown switches to German. Following this alteration, the original post becomes disconnected from its translated version. Subsequently, when a new translation of the same post is added, duplication occurs so you have e.g. hidden link |
May 29, 2024 at 1:56 pm #15684336 | |
arnoP-3 |
1. We never manually change URLs to edit posts. That was only for debugging the issue, trying to understand what's happening. 2. We very rarely make changes to URLs. If we do it, we go into the WPML Advanced Translation Editor and change the German slug there. That has happened maybe 3 times in 6 months. It worked fine. It's not our workflow. We always carefully edit via the Advanced Translation Editor. There was no issue until we updated the plugins last week. Our workflow has not changed. There's a bug inside WPML that is causing this, because it even happens with all other plugins disabled. I have no steps to reproduce this. It's a problem that is permanent, it doesn't come and go. All I can think of is providing you with an old backup of the site (before the updates and this issue). That should not have this issue, although I don't know what happens if you restore it, maybe that triggers it too. If you then update all plugins, WordPress, and the theme, it's likely that the problem will occur. Can you please urgently get a developer to look into this? A developer should be able to see what's actually going wrong on the code level. We can't edit any posts now, to prevent making the issue even bigger. It's a big problem on our end. Note that we can't restore a backup because this is a dynamic site. New user accounts and forum posts have been created. Apart from that, we need to actually fix this because it could happen again if we don't. |
May 29, 2024 at 3:04 pm #15684691 | |
arnoP-3 |
Actually, I do see something suspicious in the database. This query returns an English post and its German version. They have not been edited in a while. The last time was way before the update. This query shows that both posts have language_code set to "en": I bet that's not ok, and it wasn't like that before the update. |
May 30, 2024 at 2:38 pm #15688603 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Can you please do the following: 1. Install and activate the Activity Log plugin from [Aryo Activity Log](https://wordpress.org/plugins/aryo-activity-log/). Also send us the backup as the site was before this happened. There is nothing at the code level we can see here, only entries in database. |
May 30, 2024 at 4:03 pm #15688855 | |
arnoP-3 |
I have installed both plugins but I have some questions. Step 2/5: can I only backup the database or do you need all files? The full backup is 15 Gb and Duplicator has failed creating it in the past. Step 3: any specific post you'd like me to edit? Apart from finding the cause of this: do you have ideas on how to safely fix this? I manually counted all posts with this problem and it seems like it's "only" 38. Some post types have no issues, others only 1 post with an issue, and others have more. Thanks, |
May 31, 2024 at 1:04 pm #15692449 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
I am checking this with our 2nd tier and will keep you posted. Let me see if they think fixing existing would be simpler than comparing backup and existing site and doing an update to see if this can be triggered somehow. |
June 3, 2024 at 7:53 am #15696608 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We checked the DB 702575 is the actual DE post that is connected to 102136. 702574 was created just 3 seconds before the 702575 and it was at the time of October, 2023. If WPML had created those duplicates then the published date would have been the same. Also, it would not happen after the recent update given that we see that the post is duplicated in 2023. Can you please try the following: 1. **Run the Query to Identify Duplicates**: set sql_mode = ''; SELECT p.post_title, p.post_type FROM `wp_posts` p JOIN `wp_icl_translations` as t ON p.ID = t.element_id AND t.element_type = CONCAT('post_', p.post_type) WHERE t.source_language_code IS NULL GROUP BY p.post_title HAVING COUNT(p.post_title) > 1; This query will help you identify posts that have the same title in the original language, which are not properly translated into other languages. 2. **Manual Cleanup**: 3. **Backup and Activity Log**: 4. If the issue persists provide the backup and detailed activity logs, then perform the necessary actions on the site. If the issue is reproduced, let us know. |
June 3, 2024 at 10:42 am #15697476 | |
arnoP-3 |
Hi Bruno, Thank you. I adjusted the query to this to prevent it from returning post types that aren't the ones in the frontend: set sql_mode = ''; Both your query and the adjusted one don't return all the posts that I had identified manually. That's probably because our titles are very short (e.g. just a town name) and duplicates are expected there (because town names don't change with the language mostly). We use the custom field content_long_title as our main post title. I tried to use that instead but didn't get the query to work. However, I did try step 2 on only the Activity post type. I went to the list of posts in the WordPress admin with WPML set to English. I deleted 12 German posts from there. Now, the number of English and German posts is the same, and everything looks fine in the frontend and backend, for this post type. So, I am tempted to go ahead and do this on the live site for all post types. Nevertheless, it would be handy if the query worked, to be sure I won't miss anything. As for the posts being duplicated a long time ago: that's an interesting finding. That means that those duplicates were in the database all along, but only started showing up in the frontend and backend lists recently for some reason. Perhaps they were in the database but not marked as English yet, because that's what's causing the German duplicates to show up along with English posts. The only possible cause I can think of, is that an editor perhaps had multiple browser tabs open, and switched the WPML language to German in one of the tabs. And then went to work in the tab still showing English while that actual WPML language was switched to German. |
June 3, 2024 at 12:36 pm #15697898 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We think that the issue was only on the workflow side, so if we would have steps to reproduce this, we could try to track it down and fix it so that even the workflow would not cause such issue. |
June 3, 2024 at 1:00 pm #15697944 | |
arnoP-3 |
I will certainly let you know if I can reproduce it or if it spontaneously happens again. For now, I will go ahead and delete the duplicates in the live site, if that's ok? If you have a query that works for the content_long_title field, please let me know. |
June 3, 2024 at 1:45 pm #15698099 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
content_long_title would be meta_key within wp_postmeta? If so, something like this may work: SET sql_mode = ''; SELECT pm.meta_value AS content_long_title, p.post_type FROM `wp_posts` p JOIN `wp_icl_translations` as t ON p.ID = t.element_id AND t.element_type = CONCAT('post_', p.post_type) JOIN `wp_postmeta` pm ON p.ID = pm.post_id AND pm.meta_key = 'content_long_title' WHERE t.source_language_code IS NULL AND p.post_type <> 'attachment' AND p.post_type <> 'wp_block' AND p.post_type <> 'nav_menu_item' AND p.post_type <> 'mb-post-type' AND p.post_type <> 'mb-taxonomy' AND p.post_type <> 'wp_navigation' AND p.post_type <> 'revision' GROUP BY pm.meta_value HAVING COUNT(pm.meta_value) > 1; This query will find posts where the content_long_title field has duplicate values. |
June 3, 2024 at 3:35 pm #15698449 | |
arnoP-3 |
Yes, correct. But the query only returns 1 record so it doesn't work unfortunately. I will try and do it based on my manual findings. It's not that many posts so hopefully I won't miss any. |
June 4, 2024 at 5:30 am #15699699 | |
arnoP-3 |
I have now checked the live site and deleted 29 duplicate posts there. I guess that will solve this for now but I'll keep an eye on it. My conclusion is: I tried to reproduce this yesterday but did not succeed. Thanks for your assistance. I hope we can one day find out what is actually causing this. |
June 4, 2024 at 10:15 am #15701047 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Sounds like a plan, if you find a way to reproduce this let us know so we could have a look. |