I have a website running on GrandNews WordPress Theme (https://themeforest.net/item/grand-news-news-magazine/15885465) and loading via KeyCDN. The site is loading a CSS file located at websitedomain.kxcdn.com/wp-content/themes/grandnews/modules/kirki/assets/css/kirki-styles.css which is of 0KB size and not in use. This file "kirki-styles.css" is making website load slow as you can see here: http://prntscr.com/qoho6e and CDN support suggested me to dequeue the stylesheet in a child theme functions.php file which I tried to but somehow it's not working and server still try to load file and gives 504 error.

Maybe something wrong with my code. So far I have followed these steps:

  1. Created a Child Theme and tested it... It's working.
  2. Tried following pieces of code to try to make it to work (Nothing extra)

     add_action('wp_enqueue_scripts', 'kirki_style_remove', 100);
        function kirki_style_remove()

    Tried this way once as well:

    function wp_dequeue_kirki_style()
        wp_dequeue_style('kirki-styles', 'websitedomain.kxcdn.com/wp-content/themes/grandnews/modules/kirki/assets/css/kirki-styles.css');
        // wp_deregister_style('kirki-styles');
    add_action('wp_enqueue_scripts', 'wp_dequeue_kirki_style', '999');

Apart from these two codes above, I also tried a plugin but that didn't work as well.

Please advise with the most efficient solution. Thanks in advance!

1 Answer 1

function wp_dequeue_kirki_style()

add_action('wp_enqueue_scripts', 'wp_dequeue_kirki_style');

Please make sure that you have handler name kirki-styles in the parent theme for the css file that you want to remove. Because wp_dequeue_style function used handler as parameter. You can check documentaion of dequeue function here => https://developer.wordpress.org/reference/functions/wp_dequeue_style/

  • thanks for your help... It did worked: prntscr.com/qoihtt I was putting the handler name wrong. You are a life saver :)
    – Sheryl
    Commented Jan 16, 2020 at 11:54
  • Actually no, it's back again (though a few minutes back it was not there). I can still see the issue (504 and too much time to load) in Private Window :(
    – Sheryl
    Commented Jan 16, 2020 at 12:12
  • Please clear all the caches and check using view page source is the file loading or not? Commented Jan 16, 2020 at 12:13
  • Thanks for your suggestions. So, I tried clearning cache multiple times but issue was still there. Then I disabled the cache plugin which fixed the issue as you asked the file is still getting included in the source: prntscr.com/qojvwb and console: prntscr.com/qojw6f. However, the difference which I have noticed is that it's not coming from CDN (not a CDN path like it was earlier). May be because of disabling cache plugin WP Fastest Cache has stopped calling CDN version of the file?
    – Sheryl
    Commented Jan 16, 2020 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.