I am trying to delay the loading of a css file which is blocking the other resources from loading first during the loading of the website page.
I am supposed to add this code to the functions.php file:
function delay_css_loading() {
wp_enqueue_style( 'your-css-handle', get_template_directory_uri() . '/path/to/your.css', array(), '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'delay_css_loading', 999 );
For this I have the url of the CSS file but not the handle ('your-css-handle') for the same.
How do I find the Handle of the css file in wordpress?
Tried extracting the id from the url as a the handle, but ir didnt work.
This webpage provides instructions on how to get the handles of the stylesheets running on a WordPress instance.
We can modify it slightly to output both the handle and the source (where available). This shall be the code you need.