Support

Account

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

  • Hi @megancm
    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

    Thanks
    E