Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple File Field Data Stored Incorrectly When Using WPML #7380

Open
Rig820 opened this issue Nov 25, 2024 · 0 comments
Open

Multiple File Field Data Stored Incorrectly When Using WPML #7380

Rig820 opened this issue Nov 25, 2024 · 0 comments

Comments

@Rig820
Copy link

Rig820 commented Nov 25, 2024

TLDR: File field data saved incorrectly when using PODs and WPML

I've used PODs to extend the WooCommerce product post type. The extension includes a Plain Paragraph Text field, a Plain Text field, and two File/Image/Video fields. Both File fields (downloads and certification_icons) are set to allow Multiple Files, and these are the two fields giving me an issue. The other two have had no issues at all.
The other important piece of information is that I am using WPML on this site, with 3 languages.

First noticed the issue when at different times the File data would not appear on the front end. Both fields were using a PODs template with an each function to output the data. Everything was fine on dev but after launching the site it was noticed that the data was missing on the front end. The odd part was that it could be missing for one language, two languages, all three languages, and any combination of them. If the data wasn't showing for one product in a language it wouldn't be showing for all products in that language.
For example the field may be showing in French for all products but not in the other two languages. Clicking update on any post would 'reset' this. It may make the field show in all three languages again, but it was equally likely to make it disappear from all three, or make it work in just two of them. Any combination of the three could happen.

Pods, Pod Groups, and Pod Fields are not set to be translatable. Neither are the two fields.
Image
Image
Image

The backend also wasn't showing correctly
Image

This lead me to look at the data in the wp_postmeta table. The first few products I looked at the data looked fine, like below
Image

I then came across a product where instead of having a single media post id in each of the "download" and "certification_icons" rows it would contain an object
Image

If I manually fixed those rows to contain just the files post id it would then show correctly in the backend. The below images are when I just fixed the certification_icon rows
Image
Image

The problem is clicking on update after that would revert everything back to objects. I tried this with just fixing certification_icons, just downloads, and both.

Finally if I deactivate WPML the files will display fine in the backend even though the data in the database is still objects.
Image

Updating the product, no actual changes need be made, while WPML is deactivated will then save the data correctly as post ids.
Image

Activating WPML and saving the product again, breaks it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant