Problem: I am trying to use the toolset_get_related_posts API to display some related posts, but when I echo the results I see "Array". I should see posts.
Solution: The results returned by the API will be an array of post objects. If you try to echo those directly, you will see "Array". You can loop over those objects with a foreach, or you can inspect them using print_r.
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
http://php.net/manual/en/language.types.array.php
https://codex.wordpress.org/Debugging_in_WordPress
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.
Our next available supporter will start replying to tickets in about 1.26 hours from now. Thank you for your understanding.
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 4 replies, has 2 voices.
Last updated by 6 years, 4 months ago.
Assisted by: Christian Cox.