acf_loop::get_loop │ public │ ACF 5.3.2

This function will return a loop, or loop's setting for a given index & key

Method of the class: acf_loop{}

No Hooks.

Returns

(mixed). false on failure

Usage

$acf_loop = new acf_loop();
$acf_loop->get_loop( $i, $key );
$i
.
Default: 'active'
$key
.
Default: null

Changelog

Since 5.3.2 Introduced.

acf_loop::get_loop() code ACF 6.8.8

function get_loop( $i = 'active', $key = null ) {

	// i
	$i = $this->get_i( $i );

	// bail early if no set
	if ( ! $this->is_loop( $i ) ) {
		return false;
	}

	// check for key
	if ( $key !== null ) {
		return $this->loops[ $i ][ $key ];
	}

	// return
	return $this->loops[ $i ];
}