WP_Block_Type example

if ( $this->is_registered( $name ) ) {
            _doing_it_wrong(
                __METHOD__,
                /* translators: %s: Block name. */
                sprintf( __( 'Block type "%s" is already registered.' )$name ),
                '5.0.0'
            );
            return false;
        }

        if ( ! $block_type ) {
            $block_type = new WP_Block_Type( $name$args );
        }

        $this->registered_block_types[ $name ] = $block_type;

        return $block_type;
    }

    /** * Unregisters a block type. * * @since 5.0.0 * * @param string|WP_Block_Type $name Block type name including namespace, or alternatively * a complete WP_Block_Type instance. * @return WP_Block_Type|false The unregistered block type on success, or false on failure. */
Home | Imprint | This part of the site doesn't use cookies.