0

I've placed the critical CSS between im. If I understood correctly, the non-critical CSS, the remainder remaining in the style.css) must now be loaded with a delay. A tutorial said I had to add the preload attribute to the. Per script in the functions.php. I tried the following, but it didn't work, a preload attribute wasn't set.

    function wpnoob_enqueue_styles() {
wp_enqueue_style('preload-style', 'styyle.css', false, null);
add_filter('style_loader_tag', 'wpnoob_preload_filter', 10, 2);

}

function wpnoob_preload_filter($html, $handle) { if ($handle === 'preload-style') { $html = str_replace("rel='stylesheet'", "rel='preload' as='style'", $html); } return $html;

However, I'm not sure why it should get "preload" either. Actually, the non-critical style.css should be able to be loaded later now so that it is not render-blocking? With a "defer" attribute? Can anyone tell me how to do this correctly? I'm also happy about a link to a tutorial... :) Thank You!

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Feb 26 at 21:05

0

Your Answer

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

Browse other questions tagged or ask your own question.