Site logo

[Resolved] wp_dequeue_style( 'wp-block-library' ) doesn't seem to work in Elements

Home Forums Support [Resolved] wp_dequeue_style( 'wp-block-library' ) doesn't seem to work in Elements

Home Forums Support wp_dequeue_style( 'wp-block-library' ) doesn't seem to work in Elements

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1284842
    Terry

    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

    #1285004
    Leo
    Staff
    Customer Support

    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/

    #1285057
    Terry

    Thanks, it works fine in functions.php.

    It would be nice if there was a place for it in generatepress, but this works too.

    #1285924
    Leo
    Staff
    Customer Support

    Make sure it’s in the child theme’s function.php and not the parent theme.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.