wp-includes/script-loader.php:3095Allows small styles to be inlined.
One hook fires while wp_maybe_inline_styles() runs, in this order:
The maximum size of inlined styles in bytes.
function wp_maybe_inline_styles() { global $wp_styles; $total_inline_limit = 40000; /** * The maximum size of inlined styles in bytes. * * @since 5.8.0 * @since 6.9.0 The default limit increased from 20K to 40K. * * @param int $total_inline_limit The file-size threshold, in bytes. Default 40000. */ $total_inline_limit = apply_filters( 'styles_inline_size_limit', $total_inline_limit ); $styles = array(); // Build an array of styles that have a path defined. foreach ( $wp_styles->queue as $handle ) { if ( ! isset( $wp_styles->registered[ $handle ] ) ) { continue; } $src = $wp_styles->registered[ $handle ]->src; $path = $wp_styles->get_data( $handle, 'path' ); if ( $path && $src ) { $size = wp_filesize( $path ); if ( 0 === $size && ! file_exists( $path ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: 'path', 2: filesystem path, 3: style handle */ __( 'Unable to read the "%1$s" key with value "%2$s" for stylesheet "%3$s".' ), 'path', esc_html( $path ), esc_html( $handle ) ), '7.0.0' ); continue; } $styles[] = array( 'handle' => $handle, 'src' => $src, 'path' => $path, 'size' => $size, ); } } if ( ! empty( $styles ) ) { // Reorder styles array based on size. usort( $styles, static function ( $a, $b ) { return $a['size'] <=> $b['size']; } ); /* * The total inlined size. * * On each iteration of the loop, if a style gets added inline the value of this var increases * to reflect the total size of inlined styles. */ $total_inline_size = 0; // Loop styles. foreach ( $styles as $style ) { // Size check. Since styles are ordered by size, we can break the loop. if ( $total_inline_size + $style['size'] > $total_inline_limit ) { break; } // Get the styles if we don't already have them. if ( ! is_readable( $style['path'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: 'path', 2: filesystem path, 3: style handle */ __( 'Unable to read the "%1$s" key with value "%2$s" for stylesheet "%3$s".' ),Introduced in 5.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.