Hi Guys,
I have an enfold site with child theme.
Is there a snippet you can send me to de-queue the parent theme custom.css file? It is empty but still getting served.
I cannot find a straight forward answer on the WP forums.
Thanks in advance.
Hi thinkjarvis,
You probably want to de-queue custom.css to improve performance. The better way to improve performance is to enable “CSS file merging and compression” at the Performance setting of the theme. This way only one CSS-file for the theme will be loaded and there is no need to de-queue any other CSS-files.
Hi @Emazing
I’ve solved it. Thank you for your input.
You are right. The script merge will remove the annotations and therefore the custom.css and style.css if they are not used.
This is because of a specific problem. Enfold’s built in script merge wont work on a WPEngine site I am working on. It just ignores it no matter how many times the NGINX cache is cleared.
We are using WP-Rocket instead. I wanted to prevent the custom.css script loading fullstop because script merging is currently disabled – Pending testing.
I have used the following code which works:
// Dequeue and Reregister custom.css from parent theme
add_action( 'wp_enqueue_scripts', 'enfold_remove_scripts', 9999 );
function enfold_remove_scripts() {
wp_dequeue_style( 'avia-custom' );
wp_deregister_style( 'avia-custom' );
}
Enfold Support –
Please close the issue sorry problem solved!