Hi,
I have created two post types "Tours" and "Pois" and added a many-two-many relationship between them. At the moment I have one "tour" that has relationships to several "pois".
I want to extract JSON for the "tour" *and* the "pois" that are related to the "tour".
I am able to extract the json for the "tour", but it doesn't show the relationships. I am using Javascript and the "fetch" function.
The json I get looks as follows, which is fine, but the relationships are not there:
{"id":117,"date":"2021-10-24T12:55:34","date_gmt":"2021-10-24T12:55:34","guid":{"rendered":"hidden link"},"modified":"2021-10-24T13:29:55","modified_gmt":"2021-10-24T13:29:55","slug":"test","status":"publish","type":"view","link":"hidden link","title":{"rendered":"Test"},"content":{"rendered":"","protected":false},"author":1,"template":"","_links":{"self":[{"href":"hidden link"}],"collection":[{"href":"hidden link"}],"about":[{"href":"hidden link"}],"author":[{"embeddable":true,"href":"hidden link"}],"wp:attachment":[{"href":"hidden link"}],"curies":[{"name":"wp","href":"hidden link{rel}","templated":true}]}}
----
I have also created a view trying to extract the json for the "pois" that are part of that view. I am able to extract the json for the view itself, but not for the contained "pois". It looks as follows
{"id":64,"date":"2021-10-21T20:12:04","date_gmt":"2021-10-21T20:12:04","guid":{"rendered":"hidden link"},"modified":"2021-10-21T20:12:05","modified_gmt":"2021-10-21T20:12:05","slug":"stockholms-sevardheter","status":"publish","type":"tour","link":"hidden link","title":{"rendered":"Stockholms sevärdheter"},"content":{"rendered":"This tour takes you...","protected":false},"template":"","_links":{"self":[{"href":"hidden link"}],"collection":[{"href":"hidden link"}],"about":[{"href":"hidden link"}],"wp:attachment":[{"href":"hidden link"}],"curies":[{"name":"wp","href":"hidden link{rel}","templated":true}]}}
Please advice.
Thanks,
Håkan