WP_Block_List::offsetGet

Advertisement

Summery Summery

Returns the value by the specified block index.

Syntax Syntax

WP_Block_List::offsetGet( string $index )

Parameters Parameters

$index

(Required) Index of block value to retrieve.

Return Return

(mixed|null) Block value if exists, or null.

Source 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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
5.5.0 Introduced.

Advertisement

Leave a Reply