Home › Forums › General Issues › Testing array values against Repeater fields › Reply To: Testing array values against Repeater fields
dont use the_sub_field
inside a “if-check” use get_sub_field
instead.
also dont use echo the_sub_field
echo is not necessary there.
because the_sub_field/the_field are functions that echo per se.
and get_sub_field/get_field only get/check a value that need to be saved inside a variable for later using.
try to use one of this codeparts instead of yours:
if (get_sub_field('email_domain_name') == $dom) {
the_sub_field('email_domain_name');
}
$emaildom = get_sub_field('email_domain_name');
if ($emaildom == $dom) {
echo $emaildom;
}
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.