WP_Block_List::offsetGet() WordPress Method
The WP_Block_List::offsetGet() method is used to retrieve a block from the list by its index. This is useful when you need to loop through all the blocks in a post and perform an action on each one.
WP_Block_List::offsetGet( $index ) #
Source
File: wp-includes/class-wp-block-list.php
public function offsetGet( $index ) { $block = $this->blocks[ $index ]; if ( isset( $block ) && is_array( $block ) ) { $block = new WP_Block( $block, $this->available_context, $this->registry ); $this->blocks[ $index ] = $block; } return $block; }
Expand full source codeCollapse full source codeView on TracView on GitHub