WP_Block_Type_Registry::unregister
Unregisters a block type.
Метод класса: WP_Block_Type_Registry{}
Хуков нет.
Возвращает
WP_Block_Type|false. The unregistered block type on success, or false on failure.
Использование
$WP_Block_Type_Registry = new WP_Block_Type_Registry(); $WP_Block_Type_Registry->unregister( $name );
- $name(строка|WP_Block_Type) (обязательный)
- Block type name including namespace, or alternatively a complete WP_Block_Type instance.
Список изменений
| С версии 5.0.0 | Введена. |
Код WP_Block_Type_Registry::unregister() WP Block Type Registry::unregister WP 6.9
public function unregister( $name ) {
if ( $name instanceof WP_Block_Type ) {
$name = $name->name;
}
if ( ! $this->is_registered( $name ) ) {
_doing_it_wrong(
__METHOD__,
/* translators: %s: Block name. */
sprintf( __( 'Block type "%s" is not registered.' ), $name ),
'5.0.0'
);
return false;
}
$unregistered_block_type = $this->registered_block_types[ $name ];
unset( $this->registered_block_types[ $name ] );
return $unregistered_block_type;
}