How to Remove Inline CSS from Astra?

How to Remove Inline CSS from Astra?

The following filter will remove inline CSS generated by the Astra theme and Astra Pro plugin. Paste the following code into child theme』s functions.php file

IMPORTANT NOTE: This filter will remove all the inline CSS added by Astra which will affect the styling of your website.

function astra_force_remove_style() {
add_filter( 'print_styles_array', function($styles) {

// Set styles to remove.
$styles_to_remove = array('astra-theme-css', 'astra-addon-css');
if(is_array($styles) AND count($styles) > 0){
foreach($styles AS $key => $code){
if(in_array($code, $styles_to_remove)){
unset($styles[$key]);
}
}
}
return $styles;
});
}
add_action('wp_enqueue_scripts', 'astra_force_remove_style', 99);

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注