Unlock Hidden Gems: Insider Secrets in WordPress 6.8 for Developers

Unlock Hidden Gems: Insider Secrets in WordPress 6.8 for Developers

Filter hook for loading block assets on demand

Before WordPress 6.8, the should_load_separate_block_assets filter hook had two responsibilities:

  1. To load separate stylesheets for Core blocks instead of always loading the combined wp-block-library stylesheet containing all block CSS
  2. To load scripts and styles on demand based on whether they are used on a particular page

In 6.8, a new filter hook named should_load_block_assets_on_demand exists for the second purpose of determining when to load assets. The original hook will work as before, but it’s recommended to filter it only to override whether stylesheets should be separated.

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

You May Have Missed