ACF Post Object empty return
-
I have custom post type called “Projects” and inside single-project.php view want to show Posts related to Project. I have tried to solve that problem by using ACF’s Post Object but got nothing from The Loop. I searched for the solution on Stackoverflow and AFC support page and I could not find a problem.
Maybe this ‘Post Object’ option is not even created for something like this. I don’t know.
Code inside single-project.php
if( $post_object ): // override $post $post = $post_object; setup_postdata( $post ); ?> <div> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> </div> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endif; ?>
ACF configuration https://i.imgur.com/FNnUbiw.jpg
New post configuration https://i.imgur.com/IHQqR0P.jpg
Custom post type output https://i.imgur.com/YFugBZl.jpg
In the place of question marks, I want to show Posts related to that Project.
- The topic ‘ACF Post Object empty return’ is closed to new replies.