Title: WP_Block_Type::__get
Published: November 2, 2022
Last modified: August 20, 2026

---

# WP_Block_Type::__get( string $name ): string|string[]|null

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#changelog)

Proxies getting values for deprecated properties for script and style handles for
backward compatibility.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#description)󠁿

Gets the value for the corresponding new property if the first item in the array
provided.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#parameters)󠁿

 `$name`stringrequired

Deprecated property name.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#return)󠁿

 string|string[]|null The value read from the new property if the first item in 
the array provided, null when value not found or when unknown property name provided.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#source)󠁿

    ```php
    public function __get( $name ) {
    	if ( 'variations' === $name ) {
    		return $this->get_variations();
    	}

    	if ( 'uses_context' === $name ) {
    		return $this->get_uses_context();
    	}

    	if ( ! in_array( $name, $this->deprecated_properties, true ) ) {
    		return null;
    	}

    	$new_name = $name . '_handles';

    	if ( ! property_exists( $this, $new_name ) || ! is_array( $this->{$new_name} ) ) {
    		return null;
    	}

    	if ( count( $this->{$new_name} ) > 1 ) {
    		return $this->{$new_name};
    	}
    	return $this->{$new_name}[0] ?? null;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-type.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-block-type.php#L364)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-block-type.php#L364-L387)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Block_Type::get_variations()](https://developer.wordpress.org/reference/classes/wp_block_type/get_variations/)`wp-includes/class-wp-block-type.php` |

Get block variations.

  | 
| [WP_Block_Type::get_uses_context()](https://developer.wordpress.org/reference/classes/wp_block_type/get_uses_context/)`wp-includes/class-wp-block-type.php` |

Get block uses context.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_block_type/__get/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_block_type%2F__get%2F)
before being able to contribute a note or feedback.