Eliminate render-blocking resources wordpress, wp_dequeue_style not working

40 views Asked by At

I am using wordpress and when I test the site speed on gtmetrix I get this warning Eliminate render-blocking resources. It shows me the stylesheets and the time it takes to load them, I have discovered that some of these style sheets are absolutely unneccessery for my homepage. How can I stop them from loading so my site speed could improved?

I have already tried wp_dequeue_style but it seems to be not working. here is the whole code that I am using but is not working.

function wp_remove_scripts() {
    if ( is_page( 'homepage' ) ) {
        wp_dequeue_style('font5-css-wpyt-css');
        wp_dequeue_style('wc-all-blocks-style-rtl-css');
        wp_dequeue_style('wc-blocks-vendors-style-css');
        wp_dequeue_style('bdt-uikit-css');
        wp_dequeue_style('ep-helper-css');
        }
    }
add_action( 'wp_enqueue_scripts', 'wp_remove_scripts', 99 );
0

There are 0 answers