You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The backend also wasn't showing correctly
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
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
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
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.
Updating the product, no actual changes need be made, while WPML is deactivated will then save the data correctly as post ids.
Activating WPML and saving the product again, breaks it again
The text was updated successfully, but these errors were encountered:
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.
The backend also wasn't showing correctly
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
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
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
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.
Updating the product, no actual changes need be made, while WPML is deactivated will then save the data correctly as post ids.
Activating WPML and saving the product again, breaks it again
The text was updated successfully, but these errors were encountered: