ACF Repeater in Taxonomy Archive

Hello,

I can’t get the L&L loop for ACF Repeater to work in a Taxonomy Archive:

<Loop acf_repeater=my_acf_repeater>
  <Field my_acf_field />
</Loop>

I also tried with CCS and can’t get to output the repeater’s data either:

Any idea please?

Hello - OK, I will try to reproduce the issue on my side, and see why it’s not working.

Just to confirm: does this repeater field belong to a taxonomy term?

I remember ACF has a special way to get fields from a taxonomy term, so it’s likely related to this. (In ACF docs: get_field() - Get a value from different objects)

Hi @eliot, yes the ACF Repeater field is in a Group assigned to a Taxonomy, its data are filled while editing a taxonomy term.

If it helps, i made a custom shortcode, inserted in the Taxonomy Archive template with Beaver Themer.
Here’s how i fetch the repeater (field named prog_projects):

$term = get_queried_object();
$taxonomy = $term->taxonomy;
$term_id = $term->term_id;  

// ACF Repeater
if( have_rows('prog_projects', $taxonomy . '_' . $term_id) ):
	while(have_rows('prog_projects', $taxonomy . '_' . $term_id)): the_row(); ?>

		// Do something

	endwhile;
endif;

So, I’m testing “ACF Repeater in a Group in a Taxonomy Term”, and it seems to be working OK, at least for my particular test cases.

Comparing with your PHP example, I notice a difference: the L&L template needs to have a Loop for taxonomy, group, and repeater.

<Loop taxonomy=category include=test-category-1>
  <Loop acf_group=test_group>
    <Loop acf_repeater=test_group_repeater>
      <Get loop=count />. <Field text /> <br>
    </Loop>
  </Loop>
</Loop>

I’m guessing you might be missing the loop for group?

Hi @eliot,

Thanks for the lead, sorry i did not find the time to test and answer sooner.
You’re right, i probably did not nest enough loops to reach the data.
Will report in this ticket when i’ll test again.

Best regards

1 Like