It is a series article about solving problems from WordPress in order to speed up WordPress blogs. In this article, you will learn to solve how to defer parsing JavaScript in WordPress. The other similar WordPress speed up solved issues can be found here. What actually Defer parsing of JavaScript does? It reduces the initial page load of your page.
If you are looking to boost up your blog add the following code snippet in your WordPress theme’s functions.php file before closing PHP tag ?> (if there is one):
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return "$url' defer ";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
Once done. Try testing your WordPress blog using online website page speed testing tools. Comment below if you have any question..
0 comments:
Post a Comment