Skip to main content

Assets Filter

This page documents the filter for controlling CSS asset inlining.

FilterDescription
unblock/assets/css_inline_sizeCSS inline size threshold

assets/css_inline_size

Control the CSS file size threshold for inlining. Files smaller than this threshold are inlined in the HTML instead of linked externally.

ParameterTypeDescription
$thresholdintSize in bytes

Default: 51200 (50 KB)

Example: Increase Threshold

add_filter( 'unblock/assets/css_inline_size', function ( $threshold ) {

return 100 * 1024; // 100 KB

} );

Example: Disable Inlining

add_filter( 'unblock/assets/css_inline_size', function ( $threshold ) {

// Return 0 to always use external files.
return 0;

} );

Example: Always Inline

add_filter( 'unblock/assets/css_inline_size', function ( $threshold ) {

// Return a large value to always inline.
return PHP_INT_MAX;

} );

Next steps