Hi,
I have problem with preloader image. Sometime (First visit, clear website Data etc.) preloader stuck. In preloader settings try When DOM ready and second setting but same problem. I think it’s problem in some optimization setting in function.php Like this
// Async js
function async_parsing_of_js( $url ) {
if ( is_user_logged_in() ) return $url; //don't break WP Admin
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return str_replace( ' src', 'async src', $url );
}
add_filter( 'script_loader_tag', 'async_parsing_of_js', 10 );
// Remove type='text/javascript' and style
add_filter('style_loader_tag', 'codeless_remove_type_attr', 10, 2);
add_filter('script_loader_tag', 'codeless_remove_type_attr', 10, 2);
function codeless_remove_type_attr($tag, $handle) {
return preg_replace( "/type=['\"]text\/(javascript|css)['\"]/", '', $tag );
}
Comments
1-st code is for async load js scripts except jquery
2-nd code is for remove type from CSS and js
https://codeless.co/remove-type-attribute-from-wordpress/
If change async with defer in frst code work fine, but is slower
We have made safe optimizations that wouldn't conflict with anything.
It is hard to say what your changes can make, as it requires some testing.
Generally, we never use async, as this would fail much code that depends on the "ready" event of the JavaScript.
With kind regards.