reset_block_rows()

Description

Resets the repeater block rows after the while loop in a way that is similar to wp_reset_postdata(). Call this after the repeater loop. This allows for multiple repeater loops to be used in a single template.

reset_block_rows( $name );

Parameters

  • $name (string)(Required) The repeater field name

Usage

In this example, reset the repeater block rows after calling the repeater field and its sub-fields.

while ( block_rows( 'example-repeater-field' ) ) :
  block_row( 'example-repeater-field' );
  block_sub_field( 'example-repeater-subfield' );
endwhile;
reset_block_rows( 'example-repeater-field' );