Uses
Uses | Description |
---|---|
wp-includes/l10n.php: __() | Retrieve the translation of $text. |
wp-includes/class-wp-error.php: WP_Error::__construct() | Initialize the error. |
Get the block, if the name is valid.
(string) (Required) Block name.
(WP_Block_Type|WP_Error) Block type object if name is valid, WP_Error otherwise.
File: wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
protected function get_block( $name ) { $block_type = $this->block_registry->get_registered( $name ); if ( empty( $block_type ) ) { return new WP_Error( 'rest_block_type_invalid', __( 'Invalid block type.' ), array( 'status' => 404 ) ); } return $block_type; }
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_block_types_controller/get_block