Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 9 replies, has 2 voices.

Last updated by Waqas Bin Hasan 2 days, 11 hours ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 1, 2024 at 10:15 am

attilioC-2

Background of the issue:
I have created with ACF a field called Tags of type taxonomy tags nume field tags translation preferences translate taxonomy tags locations rules attached, which is matched to all the images attached to the post. The site has two languages, the main one being English and Italian. The problem is that although the tags are translated, they are not displayed in the Italian version. I have checked the DB and there is a correspondence between the English tags and the Italian tags.

Symptoms:
In the English version, the tags are displayed correctly: hidden link. They are not displayed in the Italian version: hidden link.

Questions:
Why are the translated tags not displayed in the Italian version?
How can I ensure that the tags are displayed correctly in both languages?

July 1, 2024 at 11:05 am
July 1, 2024 at 11:06 am #15868027

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Reference to our recent chat, I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.

Your next answer will be private, to share this information safely.

Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend.

IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

Regards.

July 1, 2024 at 11:09 am
July 1, 2024 at 1:00 pm #15868716

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the access, I was able to login.

I am looking into this and 'll get back to you accordingly.

July 1, 2024 at 5:50 pm #15870082

attilioC-2

The example article with the tags configured is as follows
hidden link

July 2, 2024 at 7:22 am #15873072

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I analyzed the issue in much detail and found that the code you're using is fine.

The problem is when a tag (or taxonomy) is added to a post type (i.e. media is post_type = "attachment"), an entry is added in postmeta table (i.e. meta_key "tags" with related values).

Since you add media in default language and then assign some tags, this works fine.

However, if you switch to secondary language and edit the media, you may notice for some media, the tag is pre-filled with its translated version (provided that the tag has been translated). BUT, in database there's no postmeta entry for this version of media.

To fix this, all you need to edit the media in secondary language, remove any existing visible tag if any, and add the tag(s) again. So the postmeta table entry for the attached tags is created for secondary language media also.

On this post hidden link, I've tried this with a few images and have left one as it is, as a proof of concept, please see attached.

Screenshot 2024-07-02 121628.jpg
Screenshot 2024-07-02 121539.jpg
Screenshot 2024-07-02 121507.jpg
Screenshot 2024-07-02 121311.jpg
July 2, 2024 at 11:15 am #15874633

attilioC-2

I thank you for the valuable analysis.
You have not modified any files?
Can I proceed with the BK reset?

July 2, 2024 at 12:28 pm #15875161

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

No, I didn't modify any file, except the template-parts/single.php to add some echo and print_r statements, which I guess I removed later on.

July 2, 2024 at 3:42 pm #15876721

attilioC-2

Thank you for your efficient assistance

July 2, 2024 at 7:16 pm #15877790

attilioC-2

Hi,
I tried inserting renamed images from scratch. but I notice that there are tags that are duplicated in Italian, as you can see in the attached images, as a family.

If I try to delete the family tag it remains visible even if only once. Although it is not included in the tags. This also happens with other tags, I have tried on several images. Whereas in the English version everything works correctly.

It is as if WPML does not delete some tags but leaves them attached to the image even though they are no longer configured on it.

Another problem, always in Italian, if I try to insert the tag "musica" it doesn't find it, but if I try to create it it tells me that it already exists.

Thank you in advance

seconda.png
prima.png
July 3, 2024 at 7:25 am #15881528

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the details.

I observed these issue in your site and also noticed that when you remove a tag, it is removed from the database but stays on frontend. So when you add the same tag again, it starts duplicating.

I've also tried clearing caches and troubleshooting options but looks like it needs detailed investigation.

Since this issue is different than the originally reported in this ticket, I recommend opening a separate ticket because as per forum policy we can only handle one issue per ticket. So you can get more to the point help, without mixing up several issues in one long ticket.