Excluded JS also not deferred?
-
Hi
When excluding js from minification/combining these files are also not deferred which causes a low score on GTMetrix for ‘Defer parsing of JavaScript’. Is this intentional? Could excluding from combining and minifying be separated from deferment?
I currently use the code below for some of my excluded js but could this be expanded to accommodate scripts on the list of exclusions as I also exclude all core WP js for compatibility and I don’t really want to list every handle for those?
function defer_js_scripts( $tag, $handle, $src ) { $defer = array( 'js1', 'js2', 'js3'); if ( in_array( $handle, $defer ) ) { return '<script id="'.$handle.'" src="' . $src . '" defer></script>' . "\n"; } return $tag; } add_filter( 'script_loader_tag', 'defer_js_scripts', 10, 3 );
Also, is it safe to delete the htaceess backups as indicated in the github post below as they still exist on my server?
https://github.com/litespeedtech/lscache_wp/issues/221
Many thanks for your time
- The topic ‘Excluded JS also not deferred?’ is closed to new replies.