wp-proudcity icon indicating copy to clipboard operation
wp-proudcity copied to clipboard

Evaluate WP 6.4 script loading changes

Open curtismchale opened this issue 8 months ago • 0 comments

Source CM

There are some enhancements coming for WP 6.4 for loading scripts. We need to look at our script loading for themes/plugins and make sure that they continue to function with the update. I do expect that they will continue to function, but should we be adjusting how we load scripts to get more performance out of the new features in 6.4 and 6.3?

We should change how we load scripts to use the new defer/async properties. The example below uses both the in_footer argument which was the old default and the new async argument.

wp_register_script( 
    'bar', 
    '/path/to/bar.js', 
    array(), 
    '1.0.0', 
    array(
        'in_footer' => true,
        'strategy'  => 'async',
    )
)

WP Rocket also has some settings around this that we need to take into account.

curtismchale avatar Oct 17 '23 23:10 curtismchale