Blog

WordPress block scripts loading on all pages

Having trouble with WordPress blocks loading on all pages of your site? I was, Fortunately @wp_acf were able to point me in the right direction.

The hook you need is should_load_seperate_core_block_assets. Yes that is an interesting hook name.

add_filter( 'should_load_separate_core_block_assets', '__return_true' );

Add that to your functions file to load scripts only on the pages your block has been added to.

@goodjobjohn