• I don’t know why , some pages and posts are not use the Gallery box Block and they still loading the follow files
    /wp-content/plugins/gosign-gallery-box-block/assets/vendor/slick/css/slick.min.css
    /wp-content/plugins/gosign-gallery-box-block/assets/vendor/slick/css/slick-theme.min.css
    /wp-content/plugins/gosign-gallery-box-block/assets/vendor/fancybox/dist/jquery.fancybox.min.css
    /wp-content/plugins/gosign-gallery-box-block/blocks/style.min.css
    /wp-content/plugins/gosign-gallery-box-block/assets/vendor/slick/js/slick.min.js
    /wp-content/plugins/gosign-gallery-box-block/assets/vendor/fancybox/dist/jquery.fancybox.min.js
    /wp-content/plugins/gosign-gallery-box-block/assets/js/script.min.js

    how to stop loading above files when pages and posts are not use the Gallery box Block?

Viewing 1 replies (of 1 total)
  • Thread Starter csit

    (@calmsmile)

    ok I found the way to remove the unnecessary css and js if the page has not use the Gallery box Block, here is the code in my child theme funcitons.php:

    function child_enqueue_styles() {
    if( !has_block(‘glsb/gosign-gallery-box-block’) ){
    wp_deregister_style(‘gosign-gallery-box-slick-slider-css’);
    wp_deregister_style(‘gosign-gallery-box-slick-slider-css-theme’);
    wp_deregister_style(‘gosign-gallery-box-fancybox-css’);
    wp_deregister_style(‘gosign-gallery-box-block-frontend-css’);
    wp_deregister_script(‘gosign-gallery-box-slick-slider’);
    wp_deregister_script(‘gosign-gallery-box-fancybox-js’);
    wp_deregister_script(‘gosign-gallery-box-block-backend-js’);
    }
    }
    add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_styles’, 15 );

Viewing 1 replies (of 1 total)
  • The topic ‘all pages always load 4 css and 3 js file from Gosign – Gallery box Block’ is closed to new replies.