Archived topic
wp_dequeue_style( 'wp-block-library' ) doesn't seem to work in Elements
3 replies · Started by Terry on May 14, 2020
I'm trying to stop the block library css from loading. I created an Element with this as the content:
<?php
add_action( 'wp_enqueue_scripts', 'remove_wp_block_library_css' );
function remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
}
?>
However it's still loading: https://www.terrys-service.com/wp-includes/css/dist/block-library
/style.min.css?ver=5.4.1
I tried the element in both wp_head and wp_footer with the "execute php" checkbox checked, but the file still gets loaded.
Any suggestions?
Thanks!
Terry
Hi there,
That code shouldn't be in Elements.
Can you try one of these methods?
Adding PHP: https://docs.generatepress.com/article/adding-php/
Thanks, it works fine in functions.php.
It would be nice if there was a place for it in generatepress, but this works too.
Make sure it's in the child theme's function.php and not the parent theme.