Home › Forums › ACF PRO › IF SubField of Repeater(A) matches SubField of Repeater(B), GET all SubFields(B) › Reply To: IF SubField of Repeater(A) matches SubField of Repeater(B), GET all SubFields(B)
There isn’t going to be an easy way to do something like this. You are going to need to get all of the values from the repeaters of both posts and compare them.
I would put them into arrays and then loop through both arrays.
$match_found = false;
foreach ($repeater_1 as $repeater_row_1) {
foreach ($repeater_2 as $repeater_row_2) {
// check if they are == here
// if they are set match found to true
$match_found = true;
// if you want, when a match is found you ca break
// out of this loop
if ($match_found) {
break;
}
}
// you can do it again here
if ($match_found) {
break;
}
}
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.