acf_loop::remove_loop
remove_loop
This function will remove a loop
Method of the class: acf_loop{}
No Hooks.
Returns
(true|false). true on success
Usage
$acf_loop = new acf_loop(); $acf_loop->remove_loop( $i );
- $i
- .
Default:'active'
Changelog
| Since 5.3.2 | Introduced. |
acf_loop::remove_loop() acf loop::remove loop code ACF 6.0.4
function remove_loop( $i = 'active' ) {
// i
$i = $this->get_i( $i );
// bail early if no set
if ( ! $this->is_loop( $i ) ) {
return false;
}
// remove
unset( $this->loops[ $i ] );
// reset keys
$this->loops = array_values( $this->loops );
// PHP 7.2 no longer resets array keys for empty value
if ( $this->is_empty() ) {
$this->loops = array();
}
}