wp_get_block_default_classname example


function wp_apply_generated_classname_support( $block_type ) {
    $attributes                      = array();
    $has_generated_classname_support = block_has_support( $block_type, array( 'className' ), true );
    if ( $has_generated_classname_support ) {
        $block_classname = wp_get_block_default_classname( $block_type->name );

        if ( $block_classname ) {
            $attributes['class'] = $block_classname;
        }
    }

    return $attributes;
}

// Register the block support. WP_Block_Supports::get_instance()->register(
    
Home | Imprint | This part of the site doesn't use cookies.