Problem: We have one repeatable field group (RFG) that contains another nested RFG. We would like to build a nested array in PHP that contains information from the nested RFG structure, but we are not able to access custom field values in the nested RFG using the toolset_get_related_posts API and get_post_meta.
Solution: In this case the inner, nested toolset_get_related_posts API call must be updated to query by the current outer RFG's post ID as opposed to querying by the ID of the post containing the RFGs. In the case of the outer RFG, querying by the ID of the post is appropriate, but in the case of the inner RFG, you should query by the ID of the outer RFG since the post relationship is technically established between the two RFGs.
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
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 5 replies, has 2 voices.
Last updated by 3 years, 3 months ago.
Assisted by: Christian Cox.