Title: Get related posts as array
Last modified: December 19, 2019

---

# Get related posts as array

 *  Resolved [cjmling](https://wordpress.org/support/users/cjmling/)
 * (@cjmling)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/get-related-posts-as-array/)
 * I want to be able to list of related posts as an php array or object, so i can
   further process the data and do some custom display as per my need.
 * Are there any inbuilt function?
 * If not are related posts saved as some meta or post or something. so i can do
   some custom query to get that? any info will be helpful.
 * Thanks

Viewing 1 replies (of 1 total)

 *  Plugin Author [Brecht](https://wordpress.org/support/users/brechtvds/)
 * (@brechtvds)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/get-related-posts-as-array/#post-12253335)
 * Hi there,
 * You should be able to get the array of relations from or to a specific post like
   this:
 *     ```
       $relations_to = CustomRelatedPosts::get()->relations_to( $post_id );
       $relations_from = CustomRelatedPosts::get()->relations_from( $post_id );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Get related posts as array’ is closed to new replies.

 * ![](https://ps.w.org/custom-related-posts/assets/icon-256x256.png?rev=2007814)
 * [Custom Related Posts](https://wordpress.org/plugins/custom-related-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-related-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-related-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-related-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-related-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-related-posts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Brecht](https://wordpress.org/support/users/brechtvds/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/get-related-posts-as-array/#post-12253335)
 * Status: resolved