Home › Forums › General Issues › Notice: Trying to get property of non-object Relationship field › Reply To: Notice: Trying to get property of non-object Relationship field
I got the same error using a relationship field. I removed blocks from my code until the errors going away. The setup_postdata($post)
causes this error but the code is still working and shows the_title()
or the_permalink()
.
That surprises me because in the example code it says “This example uses a function called setup_postdata which will override the global $post object and allow functions such as the_title to target the selected post.”
Hope this helps
Thomas
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.