pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Missing WPML translation_id & trid fields in REST API responses #7017

Open pavodev opened 1 year ago

pavodev commented 1 year ago

Description

My website uses Pods and WPML and one of my Custom Post Types has a relationship with media files. That specific Custom Post Type is fetched through the REST API by a mobile app and since a couple of updates I noticed that the translation fields (trid, etc.) for the media files are not sent anymore through the API. Those fields were really useful because my app has an offline feature which downloads posts with their images and it's then able to assign the images to their corresponding posts by using the translation id. This way the app downloads only one copy of the image and references it for all the languages for offline usage.

I'm not 100% sure which update removed the fields but I think the first time I noticed this issue was from 2.8.0 onwards. The last update I was able to fetch those fields with was 2.7.24. I checked both databases (old and new) and WPML still provides translation data in the wp_icl_translations table.

Version

2.9.11.1

Testing Instructions

  1. Create a Custom Post Type
  2. Add a new field of type: File / Image / Video
  3. Enable the REST API in read mode
  4. Make a GET request on https://domain/wp-json/wp/v2/customposttypename

Expected Output (before 2.8.0): [ { "id":240519, "link":"...", "title":{ "rendered":"Title" }, "content":{ "rendered":"", "protected":false }, "template":"", "image_title":"Title", "image":{ "ID":"1270", "post_author":"2", "post_date":"2019-09-17 23:59:14", "post_date_gmt":"2019-09-17 21:59:14", "post_content":"...", "post_title":"Title", "post_excerpt":"", "post_status":"inherit", "comment_status":"closed", "ping_status":"closed", "post_password":"", "post_name":"6-11", "to_ping":"", "pinged":"", "post_modified":"2020-04-29 09:25:16", "post_modified_gmt":"2020-04-29 07:25:16", "post_content_filtered":"", "post_parent":"1264", "guid":"...", "menu_order":"0", "post_type":"attachment", "post_mime_type":"image\/png", "comment_count":"0", "translation_id":"1753", "element_type":"post_attachment", "element_id":"1270", "trid":"232788", "language_code":"en", "source_language_code":"", "id":"1", "code":"en", "english_name":"English", "major":"1", "active":"1", "default_locale":"en_US", "tag":"EN", "encode_url":"0", "country":null, "pod_item_id":"1270" }, "copyright":"Jakarta Province", "_links":{...} } ]

Actual ouptut (after 2.8.0): [ { "id":240519, "link":"...", "title":{ "rendered":"Title" }, "content":{ "rendered":"", "protected":false }, "template":"", "image_title":"Title", "image":{ "ID":"1270", "post_author":"2", "post_date":"2019-09-17 23:59:14", "post_date_gmt":"2019-09-17 21:59:14", "post_content":"...", "post_title":"Salakanagara", "post_excerpt":"", "post_status":"inherit", "comment_status":"closed", "ping_status":"closed", "post_password":"", "post_name":"6-11", "to_ping":"", "pinged":"", "post_modified":"2020-04-29 09:25:16", "post_modified_gmt":"2020-04-29 07:25:16", "post_content_filtered":"", "post_parent":"1264", "guid":"...", "menu_order":"0", "post_type":"attachment", "post_mime_type":"image\/png", "comment_count":"0", "pod_item_id":"1270" }, "copyright":"Jakarta Province", "_links":{...} } ]

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

No response

Pods Package

No response

pavodev commented 8 months ago

Hello, any update on this issue? Thanks!

sc0ttkclark commented 8 months ago

Following up here with @JoryHogeveen specifically since he was last to look at this I believe

pavodev commented 3 months ago

Hi @sc0ttkclark @JoryHogeveen do you have any update on this issue?