• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

How to enable block styles to load separately in WordPress

Learn in this tutorial how to enable block styles to load separately in WordPress using code.

WordPress 5.8 introduces quite a few new features, including an improvement to how block styles are loaded.

Specifically, this enhancement allows only the styles of the blocks that are being used on the page to be loaded.

Until now, by default, the styles of all native WordPress blocks were loaded on all pages.

You can imagine that this is quite an interesting performance improvement, but to take advantage of it you have to activate it.

Here’s how:

Snippet to enable independent loading of WordPress block styles

Add the following snippet to the functions.php file:

To see this and another 997 code snippets of this website, login or subscribe here.

It’s as simple as that.

Conclusions

Now you know how to enable WordPress native block styles to load separately.

Thanks to this, the page will only load the styles of the blocks present on the page with the performance improvement that this entails.

Any questions? I read you in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉


Block Editor Block Styles PHP WordPress

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

close-icon

Lost your password?