Open cfaria opened 2 years ago
Let's retest on 2.8.6, there may be some tweaks in there that address this issue.
This is still happening in 2.8.8.1. Maybe is related to #6326 If I can help in any way I'll do what you need.
@sc0ttkclark I think this is related to meta vs podsrel tables. See #3614
@cfaria If you re-save a product, does it return a correct value then?
@JoryHogeveen No, saving the product as it is doesn't return the correct value. But if you mean to save the product selecting the values first, then the value is saved again and then it does return it when I call get_post_meta, but the old values that are not changed are still there in the database and are not returned. It only returns the values that I change. That's not possible for me as I have a lot of custom fields in a lot of CPTs.
@sc0ttkclark and I were trying to fix the issue some weeks ago and we manage to recover the post custom fields types (we tested an extended WooCommerce Product), but the values are still not returned unless I change the value and save it.
Seems like #6326 would be fixed exporting all the fields with the Migrate Package component, updating the plugin to 2.10.0 and importing with the same component. But #6325 is still there...
Hi everyone,
I see that this bug is months old but I still have the same issue with custom fields applied on media. When I save the media I can see the right values in the database but when I come back to the backend the custom field values are all wrong (so if I save again I save wrong values in the database too). This is happening for the custom fields type checkboxes yes/no.
Is there any workaround or fix for these?
Thank you!
Description
Hi,
I've created some custom fields to extend the WooCommerce Product Post type. Among them are relationships, images, plain text, WYSIWYG, etc... It works great in 2.7.31 but when I upgrade to 2.8.X (it doesn't matter wich 2.8 version) the image fields values are not returned as expected...
I'm getting the image field value with get_post_meta. If I inspect the database, the field is there with the correct value, so there shouldn't be any problem using get_post_meta.
Debugging a bit I've found out that Pods is using its own get_meta function to retrieve the value https://github.com/pods-framework/pods/blob/e3b805297b865c0788925991b74994be179b750e/classes/PodsMeta.php#L3356.
This is the callstack I've been looking at:
When I'm trying to get the value of a custom image field using get_post_meta, that field function returns false here:
https://github.com/pods-framework/pods/blob/e3b805297b865c0788925991b74994be179b750e/classes/Pods.php#L1089
and that's because this lookup_related_items call returns an empty array:
$this->data->api->lookup_related_items( $current_field['id'], $current_field->get_parent_id(), $ids, $current_field );
https://github.com/pods-framework/pods/blob/e3b805297b865c0788925991b74994be179b750e/classes/Pods.php#L1082
Tell me if I can do anything else to help to fix this issue ;D. For the moment I'll stick with 2.7.31...
Version
2.8.5
Testing Instructions
No response
Screenshots / Screencast
No response
Possible Workaround
No response
Site Health Information
Pods Package