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);

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註