Home › Forums › Add-ons › Repeater Field › Nested Repeaters Using Get Post Meta › Reply To: Nested Repeaters Using Get Post Meta
I can’t tell by looking at your code what you’re trying to do, I don’t see any “nesting”. Here is basic code to get sub fields of a nested repeater.
$repeater = 'repeater_name';
$repeater_count = intval(get_post_meta($post_id, $repeater, true));
$nested_repeater = 'nested_repeater_name';
for ($i=0; $i<$repeater_count; $i++) {
$nested_count = intval(get_post_meta($post_id, $repeater.'_'.$i.'_'.$nested_repeater, true);
for ($j=0; $j<$nested_count; $j++) {
// get value of field in nested repeater
$value = get_post_meta($post_id, $repeater.'_'.$i.'_'.$nested_repeater.'_'.$j.'_sub_field_name', true);
}
}
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.