Skip to content

Instantly share code, notes, and snippets.

@ivo-ivanov
Created August 13, 2020 09:29
Show Gist options
  • Save ivo-ivanov/49420d881f58a72b298ed73ea91bc58a to your computer and use it in GitHub Desktop.
Save ivo-ivanov/49420d881f58a72b298ed73ea91bc58a to your computer and use it in GitHub Desktop.
Check the value of a sub field, outside the while loop. #wordpress #acf
$found = false;
$value = 'Your value';
while ( have_rows( 'your_repeater_field' ) ) : the_row();
if ( get_sub_field( 'your_sub_field' ) == $value ) :
$found = true;
endif;
endwhile;
if ( $found ) {
// True
} else {
// False
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment