Skip Navigation

[Resolved] How to show post relationships in WordPress rest api

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by pumpun 6 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1105397

Good Morning,

We can not see the post relationships in the rest api (json) of WordPress. Before updating everything was simpler (_belongs to) but everything has disappeared and we need to obtain from the rest api the relations between post. Please, how does this relationship work now in the rest api? How can we know, through a query, the relationship between a post-type and a post-type?

Thank en advanced from Spain

#1105621

To access related posts in PHP, we now provide the Post Relationships API: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/

One way you could access related post information in REST is to set up a View filtered by post relationship, and use the API to retrieve the results of that View. The toolset-rest plugin created by Adriano shows how to get the results of a View: (hidden link). Otherwise, you'll have to set up a custom endpoint in the REST API, and use the Post Relationships API to return the correct information. Customizing the REST API is outside the scope of support we provide here, unfortunately.

If you'd like to see more REST API integration, please let our developers know by submitting a new ticket using the "Suggest an improvement" feature.

#1105623

Thanks