HomeSEOHow to defer parsing...

How to defer parsing of JavaScript in WordPress – Guide

Why we should work on “defer parsing of JavaScript.”

Performance and speed are most important to run a website. There are many techniques to speed up your website with “Defer Parsing of JavaScript.”

But before continue, you need to understand the reason why we should work on “defer parsing of JavaScript.”

The JavaScript mostly placed between <head></head> tags. When opening a website, it always loads the code from top to bottom. If lots of JavaScript are placed in the head section, the website will take more time to load.

After “defer parsing of JavaScript,” the website will not wait for JavaScript codes to load. That means the website will load quickly.

After implementing the steps below, you will find the results like this or Maybe much improved.

There are too many Plugins that can do the same job. But I will recommend Deferring parsing JavaScript by placing a code in the function.php file.

You can do this by accessing the function.php file using FTP or installing a small plugin “Theme editor” quickly.

Check out: How to speed up your WordPress Website using .htaccess

Don’t ever forget to keep a backup of your original file so you can back up if you found any problem on your website.

  1. The file “Function.php” is located in your WordPress theme directory. Go to /public_html/yourwebsite.com/wp-content/themes/active theme/function.php. Open the file, paste the code at the bottom of the “file,” and feel the magic.

Or

  1. Install “Theme Editor

Go to settings>>Theme Editor>>Your active theme>>function.php

Add the code at the bottom of the file. Save and enjoy

The Code (Defer Parsing of JavaScript)

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 );

Test your website again, and feel the difference. You can uninstall the “Theme Editor” Plugin after completing this job.

There are some plugins that you can also try for the same job. But as I am not recommending any plugin to Defer Parsing of JavaScript, I will not discuss these Plugins in detail.

  1. WP Deferred JavaScript
  2. Speed Booster Pack
  3. Async JavaScript

 

Most Popular

More from Author

From Keyboard to Stage: The Magic of Online Speech Writing Assistance

Are you ready to dive into the captivating world of online...

How Conducting an SEO Audit Can Improve Your Online Presence?

A strong online presence can make or break a business in...

10 Things to Consider When Crafting SEO Strategies for Niche Businesses

As a business owner operating in the digital landscape, it's essential...

7 ways Social Media Marketing can Boost Your Car dealership

Social media has undeniably become a cornerstone of our modern society,...

Read Now

Legal Due Diligence: Critical Questions to Ensure Regulatory Compliance in M&A

When engaging in a merger or acquisition (M&A) deal, conducting comprehensive due diligence is crucial to identify potential risks and ensure regulatory compliance. Legal due diligence is key in assessing the target company's compliance with applicable laws and regulations. Here are due diligence questions for M&A that...

How To Get Your Name On Top Of Google Searches?

As you know, Google is a popular search engine, and taking your brand name to the peak of its searches holds significant importance. Knowing how to get your name on the top of Google searches is critical. This is what a business, brand, or organization strives for,...

What is Direct Mail & Why It Is Still an Effective Marketing Tool

Direct mail is a tried-and-true marketing strategy now. As technology advances, businesses may prioritize digital marketing channels such as email and social media, but direct mail continues to be effective. In our article, we will define direct mail, fantastic ideas for doing it right, and explore why...

Data-driven Decisions: The role of Analytics in Effective Marketing

In today's digital landscape, data is a powerful currency that fuels strategic decision-making and drives business success—of marketing, analyzing its pivotal role in empowering businesses to make informed choices based on data-driven insights. By harnessing the power of analytics, businesses can gain a deeper understanding of their...

The Growing Challenge Of Ranking For Commercial Keywords: Overcoming Obstacles 

In the ever-evolving landscape of search engine optimization (SEO), one of the biggest challenges website owners and marketers face is the increasing difficulty in ranking for commercial keywords. Commercial keywords are those that directly relate to products, services, or industries with the intent to make a purchase....

4 Reasons to Focus More on Online Marketing

In today’s fast paced, technology-driven world, everything is changing – including the way we do business. In 2023, online marketing is all but replacing traditional advertising channels, and if you start leaning more in this direction, it will only boost your business and help you keep up...

What Are The Best Ways To Increase My Brand Awareness Online?

One of the most apt idioms to highlight the importance of brand awareness in digital marketing is: “You can lead a horse to water but you can’t make them drink.” For example, it doesn’t matter how much traffic you have heading to your website, if you have very...

How to Optimize Your Site For Mobile Users

Mobile devices have become our constant companions in today's world, and their influence on web browsing continues to soar. With growing smartphone users, ensuring your site delivers an exceptional mobile experience is crucial. In this blog, we'll unveil the best practices to make your website mobile-friendly, capturing the...

6 Best WordPress SEO Plugins for Boosting Website Traffic

Do you know why only a few websites appear at the top of search engines? The answer is ‘good SEO. If you put the needed and the right efforts into this vital part, you can grab the topmost seat on search engine results. A website is built with...

Does Email Marketing Have Any Impact On Your Search Engine Optimization?

In the world of digital marketing when there are so many different strategies available to you, it’s always worth looking for ways in which two or more methods can be used to complement one another – for example, using video marketing to increase social media engagement. But...

From Dated to Dazzling: Transform Your Website with Professional Redesign Services

The development pace of websites is skyrocketing. And in 2023, site owners can't afford to have their pages look the same for months or years on end. But how can you revamp a site such that it's worthwhile to the business? This article will show you EXACTLY how...

Top 7 SEO Trends to Increase Organic Traffic

Search engine optimization is one of the best ways to boost organic traffic; however, keeping up with its ever-evolving trends can be challenging. SEO specialists work tirelessly to stay abreast of trends in order to deliver relevant content at exactly the time users search for it - and...