Home › Forums › Front-end Issues › Relationship returns array of string instead of post object › Reply To: Relationship returns array of string instead of post object
This is because you are using get_post_meta()
instead of get_field()
https://www.advancedcustomfields.com/resources/get_field/
ACF only stores the post IDs of the posts in a relationship field. These IDs are stored as strings. When you use get_post_meta()
you can only get what ACF stores. If you want ACF to do the work of getting the post objects then you need to use the ACF functions.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.