Home › Forums › General Issues › Relationship field on custom post types › Reply To: Relationship field on custom post types
By default, the relationship field returns an array of post objects, so your $posts->post_name won’t return your desried post’s name. You’d have to dig into the array, or iterate through it. Or do something like set the relationship field to return an array of chosen post IDs instead, and pump THAT into your query using WP_Query’s ‘post__in’ parameter
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.