wp-includes/block-supports/custom-css.php:29Render the custom CSS stylesheet and add class name to block as required.
$parsed_blockarrayarrayfunction wp_render_custom_css_support_styles( $parsed_block ) { $custom_css = $parsed_block['attrs']['style']['css'] ?? null; if ( ! is_string( $custom_css ) || '' === trim( $custom_css ) ) { return $parsed_block; } $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $parsed_block['blockName'] ); if ( ! block_has_support( $block_type, 'customCSS', true ) ) { return $parsed_block; } // Validate CSS doesn't contain HTML markup (same validation as global styles REST API). if ( preg_match( '#</?\w+#', $custom_css ) ) { return $parsed_block; } // Generate a unique class name for this block instance. $class_name = wp_unique_id_from_values( $parsed_block, 'wp-custom-css-' ); $existing_class_name = $parsed_block['attrs']['className'] ?? null; $updated_class_name = is_string( $existing_class_name ) ? "$existing_class_name $class_name" : $class_name; _wp_array_set( $parsed_block, array( 'attrs', 'className' ), $updated_class_name ); // Process the custom CSS using the same method as global styles. $selector = '.' . $class_name; $processed_css = WP_Theme_JSON::process_blocks_custom_css( $custom_css, $selector ); if ( ! empty( $processed_css ) ) { /* * Register and add inline style for block custom CSS. * The style depends on global-styles to ensure custom CSS loads after * and can override global styles. */ wp_register_style( 'wp-block-custom-css', false, array( 'global-styles' ) ); wp_add_inline_style( 'wp-block-custom-css', $processed_css ); } return $parsed_block;}Introduced in 7.0.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
src/wp-includes/block-supports/custom-css.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.