Home › Forums › Front-end Issues › Displaying a relationship field on a custom post type taxonomy page › Reply To: Displaying a relationship field on a custom post type taxonomy page
here is some code to test that the post_id is correct:
<?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while (have_posts()) : the_post(); $post_id = get_the_ID(); ?> <h2>Title: <?php the_title(); ?></h2> ID: <?php echo $post_id; ?> ACF without ID <?php echo '<pre>'; print_r( get_field('store-type', false, false) ); echo '</pre>'; ?> ACF with ID <?php echo '<pre>'; print_r( get_field('store-type', $post_id, false) ); echo '</pre>'; ?> <?php endwhile; ?> <?php endif; ?>
Please use this code and check that the post_id displayed are the ones you are expecting
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!
Sorry for the issues with ACF's API SSL certificate this morning. We've resolved it and your activations and downloads should be back to normal again. Thanks! ^LG— Advanced Custom Fields (@wp_acf) November 2, 2022
© 2022 Advanced Custom Fields.