Home Forums Front-end Issues Repeater field value doesn't display


Repeater field value doesn't display

  • Hello,

    We are using Repeater Field to display related posts as widget in single.php. We have the following code.

    $post_id = get_the_ID(); // if ACF is outside loop, use this to get post ID
    $post_objects = get_field('repeater_related_items', $post_id);
    if( $post_objects): ?>
        <div class="widget_outer als_repated_posts">
    		<?php foreach( $post_objects as $post) : // variable must be called $post (IMPORTANT) ?>
    			<?php setup_postdata($post); ?>
    				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    		<?php endforeach;?>
    		<?php wp_reset_postdata(); ?>
    <?php endif;?> 

    The Problem is that it displays only to logged in users. Once logged out it doesn’t display.


  • No response yet!?

  • We are still waiting for any reply…

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Repeater field value doesn't display’ is closed to new replies.