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