Problem: I would like to be able to get the ids of both related posts in a M2M relationship using the PHP Post Relationships API, when the intermediary post ID is known.
Solution: Use the toolset_get_related_posts API to retrieve related post information using the intermediary ID like this:
$book = toolset_get_related_posts( 123, 'book-library', 'intermediary', 1000000,0, array(), 'post_id', 'parent' ); // returns Array( [0] => 234 ) $library = toolset_get_related_posts( 123, 'book-library', 'intermediary', 1000000,0, array(), 'post_id', 'child' ); // returns Array( [0] => 345 )
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
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 6 years, 4 months ago.
Assisted by: Christian Cox.