WordPress at Your Fingertips
function is not described

WP_Block::__get() public WP 5.5.0

Returns a value from an inaccessible property.

This is used to lazily initialize the attributes property of a block, such that it is only prepared with default attributes at the time that the property is accessed. For all other inaccessible properties, a null value is returned.

{} It's a method of the class: WP_Block{}

No Hooks.


Array|null. Prepared attributes, or null.


$WP_Block = new WP_Block();
$WP_Block->__get( $name );
$name(string) (required)
Property name.


Since 5.5.0 Introduced.

Code of WP_Block::__get() WP 5.8.1

public function __get( $name ) {
	if ( 'attributes' === $name ) {
		$this->attributes = isset( $this->parsed_block['attrs'] ) ?
			$this->parsed_block['attrs'] :

		if ( ! is_null( $this->block_type ) ) {
			$this->attributes = $this->block_type->prepare_attributes_for_render( $this->attributes );

		return $this->attributes;

	return null;