0

I want to show some repeater fields on tag archive page. with this code I can display the simple text fields of acf:

$term = get_queried_object();
$meta = get_field('test', $term);

but when want to output the acf repeater have no success.

$term = get_queried_object();
if (have_rows('faq', $term)) :
    while (have_rows('faq', $term)) : the_row();
        echo get_sub_field('question');
        echo get_sub_field('answer');
    endwhile;
endif;
3
  • Repeaters are a premium feature I think, so hopefully you can ask ACF support directly?
    – Rup
    Dec 24, 2020 at 13:15
  • When you say you have no success, what exactly is happening? I guess $term is the correct object, that does have a faq meta field? Are you getting false from have_rows even though you do have a value for faq? Is it definitely a repeater / multivalued field? Can you try debugging ACF's have_rows for the value you have to see why it's rejecting it? Or is that returning true, and you're having issues with the_row?
    – Rup
    Dec 24, 2020 at 13:16
  • actually when call the: $fields = get_field("faq"); var_dump($fields); it returns "null" or when: $term1 = get_queried_object(); $fields = get_field("faq", $term); var_dump($fields); it returns the count of added repeater items not values.
    – Mohammad J
    Dec 25, 2020 at 21:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.