This function will return an array containing all sub field values for the current row within a have_rows() loop.

Change Log

  • Added in version 5.3.3


$row = get_row( $format_values );
  • $format_values (boolean) whether or not to format the value loaded from the db. Defaults to false (not required).


This example demonstrates how to use this function to get the current row and output sub field data. This is not the standard way to output sub field data (we advise using get_sub_field() and the_sub_field()), but it can be handy.

Note that the_row() also returns the current row array (and it also progresses through the loops).

<?php if( have_rows('slides') ): ?>

	<?php while( have_rows('slides') ): the_row(); 
		// vars
		$row = get_row();
		if( $row['image'] ): ?>
			<img src="<?php echo $row['image']; ?>" />
			<p><?php echo $row['caption']; ?></p>
		<?php endif;

	<?php endwhile; ?>

<?php endif; ?>