{"id":1850917,"date":"2022-02-21T13:20:00","date_gmt":"2022-02-21T12:20:00","guid":{"rendered":"https:\/\/wp-rocket.me\/?p=1850917"},"modified":"2024-06-04T17:06:30","modified_gmt":"2024-06-04T15:06:30","slug":"deferred-loading-of-javascript","status":"publish","type":"post","link":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/","title":{"rendered":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)"},"content":{"rendered":"<p>Do you think dealing with JavaScript is challenging? You\u2019re not alone. JavaScript is difficult to learn because it is powerful: it adds dynamic and interactive elements to the web page to engage with the user.&nbsp;<\/p><p>If you\u2019ve ever audited your WordPress site through GTmetrix or PageSpeed Insights, you\u2019ve probably come across the suggestion to \u201cdefer parsing of Javascript\u201d:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"891\" height=\"270\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix.png\" alt=\"Eliminate render-blocking resources by deferring non-critical JS - Source: GTmetrix\n\" class=\"wp-image-4130348\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix.png 891w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix-310x94.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix-768x233.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix-190x58.png 190w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Eliminate-render-blocking-resources-by-deferring-non-critical-JS-Source-GTmetrix-297x90.png 297w\" sizes=\"(max-width: 891px) 100vw, 891px\" \/><figcaption class=\"wp-element-caption\"><em>Eliminate render-blocking resources by deferring non-critical JS &#8211; Source: GTmetrix<\/em><br><\/figcaption><\/figure><p>In plain English, it means that some Javascript is affecting your site loading time \u2014 and that you should do something to improve speed.&nbsp;<\/p><p>In this tutorial, you\u2019ll learn everything you need to know about deferring Javascript and why it\u2019s crucial for the performance of your WordPress site. Because deferring JavaScript can be daunting at first, we\u2019ll share some easy optimization techniques you can implement for your site.&nbsp;<\/p><h2 class=\"wp-block-heading\">What Does Defer Parsing of JavaScript Mean?<\/h2><p>Defer Parsing of Javascript means to delay the JS processing that is not needed immediately on the visitor\u2019s screen. Deferring Javascript is a key optimization technique to <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minimize-main-thread-work\/\">minimize your main thread work<\/a> and remove useless weight during the page load.&nbsp;<\/p><h3 class=\"wp-block-heading\">What Do Defer and Parsing Mean in Javascript<\/h3><p>When you defer Javascript, here\u2019s what happens: you postpone or delay the loading of Javascript to load the most important content first. You tell the browser not to process (parse) a part of the Javascript just yet. Instead, the actual page content will get the loading priority over the JS code that must be executed immediately.&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>\ud83d\udcd6&nbsp; To keep in mind:<\/strong><br><br><strong>Defer<\/strong> = to load at a later time <em>or<\/em> postpone a part of the code<br><br><strong>Parsing <\/strong>= the process of &#8220;reading&#8221; and &#8220;understanding&#8221; the code by the browser<br><br><strong>JS usual path<\/strong> = Download &gt; <strong>Parse <\/strong>&gt; Compile &gt; Execute &gt; Render on the visitor\u2019s screen<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\">Defer Parsing of Javascript to Reduce Blocking of Page Rendering<\/h3><p>The render-blocking resources are stylesheets, Javascripts, and HTML that delay or block the browser from displaying the page content to the visitor. Defer Parsing Javascript is one of the strategies to eliminate render-blocking resources because the browser will <em>know<\/em> which lines of code need to be loaded in priority.&nbsp;<\/p><p>Let me show you how render-blocking resources affect browsers and the loading time with a code snippet with HTML and JS:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"1080\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/How-render-blocking-resources-affect-browsers-.png\" alt=\"How render-blocking resources affect browsers\n\" class=\"wp-image-4130368\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/How-render-blocking-resources-affect-browsers-.png 1080w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/How-render-blocking-resources-affect-browsers--195x195.png 195w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/How-render-blocking-resources-affect-browsers--768x768.png 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/><figcaption class=\"wp-element-caption\">How render-blocking resources affect browsers<br><\/figcaption><\/figure><p><strong>This is what is happening for my browser behind the scene:&nbsp;<\/strong><\/p><ol class=\"wp-block-list\"><li>My browser sees that some HTML needs to be downloaded.<\/li>\n\n<li>But then, he finds some JS to parse and execute. The browser can\u2019t execute everything at the same time: the download of my HTML (actual content) is paused.<\/li>\n\n<li><strong>Performance issue triggered:<\/strong> while my browser is processing the &lt;script.js&gt;, the rest of my HTML is blocked. Consequently, rendering the page content to the visitor takes more time.&nbsp;<\/li><\/ol><p>\u231b <strong>What changes if you defer parsing of JS?<\/strong><\/p><p>When you defer parsing of JavaScript, you tell the browser to load and parse the JavaScript file separately. The DOM &#8211; or the critical content &#8211; will be shown to the visitors immediately instead of being blocked, like in our above example.<\/p><h2 class=\"wp-block-heading\">Why Defer Loading of Javascript is Important for Performance<\/h2><p>Deferring loading of Javascript and optimizing javascript parsing will significantly reduce the render time of your page and improve your performance. But why?<\/p><p>Remember that the browser must go through the contents of all &lt;script&gt; tags to load a page. The more scripts you have to process, the more page loading will increase.<\/p><p>Consequently, if you delay some of the Javascripts, your browser will be able to focus on the most important: render the <strong>content being viewed by the visitor<\/strong> as fast as possible.&nbsp;<\/p><p>To achieve this outstanding performance, your browser needs to prioritize the most critical code to achieve this outstanding performance. As a result, any actions towards Javascript code optimization and prioritization will:<\/p><ul class=\"wp-block-list\"><li><a href=\"#core-web-vitals-lighthouse\">Improve Overall Core Web Vital scores and Lighthouse performance grade<\/a><\/li>\n\n<li><a href=\"#optimize-fid\">Optimize First Input Delay<\/a><\/li>\n\n<li><a href=\"#optimize-lcp\">Optimize Largest Contentful Paint<\/a><\/li>\n\n<li><a href=\"#optimize-fcp\">Optimize First Contentful Paint<\/a><\/li>\n\n<li><a href=\"#eliminate-render-blocking-resources\">Eliminate render-blocking resources (PSI warning)<\/a><\/li><\/ul><p>Let\u2019s give an overview of each benefit you get by deferring the parsing of JavaScript.<\/p><h3 class=\"wp-block-heading\" id=\"core-web-vitals-lighthouse\">Improve Overall Core Web Vital Scores and Lighthouse Performance Grade<\/h3><p>You may have heard of the <a href=\"https:\/\/wp-rocket.me\/blog\/google-page-experience-update-2021\/\">Google Page Experience<\/a>, which includes the <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/\">Core Web Vitals as a ranking factor<\/a>.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev.png\" alt=\"SEO, user experience, and performance - Source: WebDev\n\" class=\"wp-image-4130380\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev.png 960w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev-310x174.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev-768x432.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev-107x60.png 107w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/SEO-user-experience-and-performance-Source-WebDev-160x90.png 160w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">SEO, user experience, and performance &#8211; Source: WebDev<br><\/figcaption><\/figure><p>Google says that providing great content is not enough anymore: you also need to take care of the loading time, the perceived speed from a user perspective, the overall interactivity, and the stability of the page.&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td>To measure and <a href=\"https:\/\/wp-rocket.me\/blog\/improve-lighthouse-performance-score-wordpress\/\">optimize your Core Web Vitals<\/a>, you can use Lighthouse, an open-source tool for measuring the quality of a web page.&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\" id=\"optimize-fid\">Optimize First Input Delay (FID)<\/h3><p>When you defer parsing of JavaScript, you also optimize your <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-first-input-delay\/\">First Input Delay<\/a> metric<em> (one of the Core Web Vitals)<\/em>. Why? First Input Delay calculates how long it takes for the browser to respond to the first user\u2019s activity on the page (e.g., clicking on a link or tapping a button). If the browser is too busy dealing with large JavaScript files, it just can\u2019t process the requests coming from the user. By deferring the JS, the FID metric has more chance to be in the green.\u00a0<\/p><h3 class=\"wp-block-heading\" id=\"optimize-lcp\">Optimize Largest Contentful Paint (LCP)<\/h3><p>When you defer parsing JS, you\u2019ll also optimize the <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/\">Largest Contentful Paint<\/a> metric <em>(which is also a Core Web Vitals)<\/em>. It measures how long it takes for the largest element to become visible by the user. LCP content is often the most important part of a website, such as its hero header image or the title:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1180\" height=\"758\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN.png\" alt=\"Largest Contentful Paint - Source: CNN\" class=\"wp-image-4130391\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN.png 1180w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN-304x195.png 304w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN-768x493.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN-93x60.png 93w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Largest-Contentful-Paint-Source-CNN-140x90.png 140w\" sizes=\"(max-width: 1180px) 100vw, 1180px\" \/><figcaption class=\"wp-element-caption\">Largest Contentful Paint &#8211; Source: CNN<br><\/figcaption><\/figure><p>This content contributes to the user\u2019s first impression of a website: if the main image takes a long time to load, then the whole website will be seen as slow. On top of that, a fast LCP also helps reassure the user that the page will be useful.<\/p><p>To ensure a good LCP score, you also need to ensure that your <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/reduce-ttfb-server-response-times\/\">server response time is short<\/a>. You can do this by telling your browser to load its largest content first before dealing with any other JS files. Does this method sound familiar? This is called deferring parsing of Javascript.<\/p><h3 class=\"wp-block-heading\" id=\"optimize-fcp\">Optimize First Contentful Paint (FCP)<\/h3><p>The <a href=\"https:\/\/wp-rocket.me\/blog\/improving-first-contentful-paint\">First Contentful Paint<\/a> (FCP) is a user-centric metric for measuring the perceived page load speed.&nbsp; Google suggests deferring non-critical resources to ensure that the first piece of content is loaded as soon as possible.&nbsp;&nbsp;<\/p><p>The figure below shows what happens if the JS is not deferred and some JS is blocking the execution of my content (FCP):<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"327\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/First-paint-being-delayed-if-some-JS-is-found-during-the-execution-Source-GTmetrix.png\" alt=\"First Contentful Paint will be delayed if some JS is found during the execution - Source: GTmetrix\" class=\"wp-image-4130401\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/First-paint-being-delayed-if-some-JS-is-found-during-the-execution-Source-GTmetrix.png 694w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/First-paint-being-delayed-if-some-JS-is-found-during-the-execution-Source-GTmetrix-310x146.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/First-paint-being-delayed-if-some-JS-is-found-during-the-execution-Source-GTmetrix-127x60.png 127w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/First-paint-being-delayed-if-some-JS-is-found-during-the-execution-Source-GTmetrix-191x90.png 191w\" sizes=\"(max-width: 694px) 100vw, 694px\" \/><figcaption class=\"wp-element-caption\"><em>First Contentful Paint will be delayed if some JS is found during the execution &#8211; Source: <\/em><a href=\"https:\/\/gtmetrix.com\/eliminate-render-blocking-resources.html\"><em>GTmetrix<\/em><\/a><\/figcaption><\/figure><h3 class=\"wp-block-heading\" id=\"eliminate-render-blocking-resources\">Eliminate Render-blocking Resources&nbsp;<\/h3><p>Lighthouse flags all the scripts and stylesheets blocking the first paint of your page. The goal is to reduce the impact of these render-blocking content on performance by inlining critical resources, deferring non-critical ones, and removing unused code.\u00a0One effective strategy is to defer JavaScript parsing, which delays the loading of non-essential files.<\/p><p><strong>Important: how to identify what is critical content and what is not?&nbsp;<\/strong><\/p><p>You can audit your page through the Coverage tab in DevTools. Here\u2019s how to read the report:&nbsp;<\/p><ul class=\"wp-block-list\"><li>Green (critical): scripts are needed for first paint&nbsp;<\/li>\n\n<li>Red (non-critical): scripts that are not being in the viewport<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1600\" height=\"813\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev.png\" alt=\"Identifying critical vs non-critical resources - Source: WebDev\n\" class=\"wp-image-4130412\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev.png 1600w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev-310x158.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev-768x390.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev-118x60.png 118w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Identifying-critical-vs-non-critical-resources-Source-WebDev-177x90.png 177w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><figcaption class=\"wp-element-caption\">Identifying critical vs non-critical resources &#8211; Source: <a href=\"https:\/\/web.dev\/render-blocking-resources\/\">WebDev<\/a><br><\/figcaption><\/figure><p>Conclusion: to deliver the optimal performance you should defer any JavaScript that is below the fold. This will also reduce <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/reduce-javascript-execution-time\/\">Javascript execution time<\/a> and optimize the critical rendering path rendering the actual content to the user much faster.&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td>The <a href=\"https:\/\/wp-rocket.me\/blog\/critical-css\/#section-2\">Critical Rendering Path<\/a> is the sequence of steps the browser goes through to convert the HTML, CSS, and JavaScript into the final content on the visitor\u2019s screen.&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure><p>Now that we know the benefits of deferring parsing of JavaScript in WordPress, let\u2019s go over several techniques that can eliminate render-blocking JavaScript.<\/p><div id=\"om-nyrydv5iync8zrrulm5i-holder\"><\/div>\n\t<script>(function (d, u, ac) {\n\t\t\tvar s = d.createElement('script')\n\t\t\ts.type = 'text\/javascript'\n\t\t\ts.src = 'https:\/\/a.omappapi.com\/app\/js\/api.min.js'\n\t\t\ts.async = true\n\t\t\ts.dataset.user = u\n\t\t\ts.dataset.campaign = ac\n\t\t\td.getElementsByTagName('head')[0].appendChild(s)\n\t\t})(document, 20440, 'nyrydv5iync8zrrulm5i')<\/script><h2 class=\"wp-block-heading\">Defer Parsing of JavaScript: the Async and Defer Attributes <\/h2><p>To defer parsing Javascript in WordPress, you\u2019ll need to mark the non-critical content with the <strong>Async<\/strong> and <strong>Defer <\/strong>attributes. They tell the browser to load and parse the JavaScript file separately, so the DOM can be shown immediately. &nbsp;In other words, you add some interactivity to your Javascript by defining when it should be parsed.<\/p><h3 class=\"wp-block-heading\">Async vs Defer JavaScript: Which One Should You Use?<\/h3><p>Async and Defer have both have one common goal: to allow users to see the HTML content faster.&nbsp; Wondering if you should use async or defer? Here\u2019s the difference you should keep in mind. Defer is used for scripts that need the whole DOM and does not execute until everything you <em>really<\/em> need is ready. Async is used for independent scripts, like counters or ads \u2013 it\u2019s downloaded in parallel and executed as soon as it\u2019s available.<\/p><p>Let\u2019s go over each attribute:&nbsp;<\/p><ul class=\"wp-block-list\"><li><strong>Async script: <\/strong>downloads JavaScript while still parsing HTML but then pauses the HTML parsing to execute the JavaScript. It can interrupt the page rendering to execute as soon as possible in no particular order.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"386\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Async-attribute.png\" alt=\"Async attribute\" class=\"wp-image-4130418\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Async-attribute.png 743w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Async-attribute-310x161.png 310w\" sizes=\"(max-width: 743px) 100vw, 743px\" \/><figcaption class=\"wp-element-caption\">Async attribute<\/figcaption><\/figure><p><strong>Example of a script tag with the async attribute:&nbsp;<\/strong><\/p><pre class=\"wp-block-code\"><code class=\"\">&lt;script src='http:\/\/yoursitehere.com\/js\/scripts.js' async='async' type='text\/javascript'&gt;&lt;\/script&gt;<\/code><\/pre><p><\/p><p><strong>When using Async?<\/strong> \u200b\u200bFor very high-priority JavaScript resources that should run as early as possible in the loading process.<\/p><ul class=\"wp-block-list\"><li><strong>Defer script: <\/strong>downloads JavaScript while still parsing HTML and waits to execute it until after HTML parsing is finished. It won&#8217;t interrupt page rendering to execute, and the execution is done in sequence just before the DOMContentLoaded event.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"385\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attribute.png\" alt=\"Defer attribute\n\" class=\"wp-image-4130433\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attribute.png 738w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attribute-310x162.png 310w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><figcaption class=\"wp-element-caption\">Defer attribute<br><\/figcaption><\/figure><p><strong>Example of a script tag with the defer attribute:&nbsp;<\/strong><\/p><pre class=\"wp-block-code\"><code class=\"\">&lt;script src='http:\/\/yoursitehere.com\/js\/scripts.js' defer='defer' type='text\/javascript'&gt;&lt;\/script&gt;<\/code><\/pre><p><\/p><p><strong>When Using Defer? <\/strong>General JavaScript resources that aren&#8217;t critical to the initial rendering of the page can be run later in the loading process.<\/p><p>Page Speed Checklist gives a very clear overview of both attributes in the table below:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1446\" height=\"760\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist.png\" alt=\"async vs defer - Source: Pagespeedchecklist\n\" class=\"wp-image-4130441\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist.png 1446w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist-310x163.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist-768x404.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist-114x60.png 114w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/async-vs-defer-Source-Pagespeedchecklist-171x90.png 171w\" sizes=\"(max-width: 1446px) 100vw, 1446px\" \/><figcaption class=\"wp-element-caption\">async vs defer &#8211; Source: <a href=\"https:\/\/pagespeedchecklist.com\/async-and-defer\">Pagespeedchecklist<\/a><br><\/figcaption><\/figure><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Async<\/strong> doesn\u2019t mind whether the DOM is fully loaded, whereas <strong>Defer<\/strong> waits for the DOM to be loaded before it executes.<\/td><\/tr><\/tbody><\/table><\/figure><p>In the next part, we will see two ways to defer the parsing of JavaScript in WordPress \u2013 with or without the help of plugins.&nbsp;<\/p><h2 class=\"wp-block-heading\">How to Defer Javascript Manually<\/h2><p>Here are two ways to defer parsing of JavaScript manually.<\/p><h3 class=\"wp-block-heading\">Defer Javascript Manually Via Your functions.php File<\/h3><p>Here\u2019s a short tutorial to add the defer attributes to render-blocking JS using your functions.php file.&nbsp;<\/p><ul class=\"wp-block-list\"><li>Go to <strong>Appearance <\/strong>&gt;<strong> Theme Editor <\/strong>and open your functions.php file&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1331\" height=\"538\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress.png\" alt=\"functions.php file in WordPress\" class=\"wp-image-4130450\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress.png 1331w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress-310x125.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress-768x310.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress-148x60.png 148w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/functions.php-file-in-WordPress-223x90.png 223w\" sizes=\"(max-width: 1331px) 100vw, 1331px\" \/><figcaption class=\"wp-element-caption\">functions.php file in WordPress<\/figcaption><\/figure><ul class=\"wp-block-list\"><li>Add the following code snippet:<\/li><\/ul><pre class=\"wp-block-code\"><code class=\"\">function defer_parsing_of_js ( $url ) {\nif ( FALSE === strpos( $url, '.js' ) ) return $url;\nif ( strpos( $url, 'jquery.js' ) ) return $url;\nreturn \"$url' defer \";\n}\nadd_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );\n<\/code><\/pre><p><\/p><h3 class=\"wp-block-heading\">Defer Javascript with Rocket Loader<\/h3><p>The second method to defer parsing of JavaScript is to use <a href=\"https:\/\/support.cloudflare.com\/hc\/en-us\/articles\/200168056-What-does-Rocket-Loader-do-\">Cloudflare Rocket Loader<\/a> that prioritizes your actual website&#8217;s content (text, images etc) by deferring the loading of the JS. Your JS will be parsed <em>after<\/em> rendering your web page, not before.&nbsp;<\/p><p>Rocket Loader can be enabled directly from your Cloudflare Dashboard:<\/p><ol class=\"wp-block-list\"><li>Go to the <strong>Speed<\/strong> app &gt; <strong>Optimizations<\/strong>.<\/li>\n\n<li>Scroll down to Rocket Loader to enable it.<\/li><\/ol><p>If you feel overwhelmed by the attributes and by editing your functions.php file, there are several plugins that offer to defer parsing of JavaScript in WordPress. We\u2019ll go over them in the next section.&nbsp;<\/p><h2 class=\"wp-block-heading\">How to Defer Javascript With a WordPress Plugin (The Easy Way)<\/h2><p>Almost any other optimization plugins can be used but we have selected 4 popular WordPress extensions that will defer parsing of Javascript in WordPress, namely:<\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/docs.wp-rocket.me\/article\/1265-load-javascript-deferred\">WP Rocket<\/a>&nbsp;offers the powerful \u201cLoad JavaScript deferred\u201d option. The defer attribute will be applied to all the JavaScript files on your page.<\/li><\/ul><p>Here\u2019s what happens when this option is activated:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1656\" height=\"628\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket.png\" alt=\"Loading Javascript deferred with WP Rocket \n\" class=\"wp-image-4130467\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket.png 1656w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-310x118.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-768x291.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-158x60.png 158w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-237x90.png 237w\" sizes=\"(max-width: 1656px) 100vw, 1656px\" \/><figcaption class=\"wp-element-caption\">Loading Javascript deferred with WP Rocket&nbsp;<br><\/figcaption><\/figure><p>WP Rocket adds the defer attribute for you:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1033\" height=\"77\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attributes-automatically-added-by-WP-Rocket-.png\" alt=\"Defer attributes automatically added by WP Rocket \" class=\"wp-image-4130473\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attributes-automatically-added-by-WP-Rocket-.png 1033w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attributes-automatically-added-by-WP-Rocket--310x23.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-attributes-automatically-added-by-WP-Rocket--768x57.png 768w\" sizes=\"(max-width: 1033px) 100vw, 1033px\" \/><figcaption class=\"wp-element-caption\">Defer attributes automatically added by WP Rocket<\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/async-javascript\/\">Async JavaScript<\/a> gives you full control of which scripts to add an &#8216;async&#8217; or &#8216;defer&#8217; attribute to increase the performance of your WordPress website.<\/li><\/ul><p>You can enable async or defer automatically on all your scripts:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1538\" height=\"602\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Enabling-async-JS-in-one-click-Source-Async-JS.png\" alt=\"Enabling async JS in one click - Source: Async JS\n\" class=\"wp-image-4130480\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Enabling-async-JS-in-one-click-Source-Async-JS.png 1538w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Enabling-async-JS-in-one-click-Source-Async-JS-310x121.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Enabling-async-JS-in-one-click-Source-Async-JS-768x301.png 768w\" sizes=\"(max-width: 1538px) 100vw, 1538px\" \/><figcaption class=\"wp-element-caption\">Enabling async JS in one click &#8211; Source: Async JS<br><\/figcaption><\/figure><p>Or you can apply the attribute to each script manually:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1530\" height=\"599\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Manually-adding-Async-on-each-script-Source-Async-JS.png\" alt=\"Manually adding Async on each script- Source: Async JS\" class=\"wp-image-4130490\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Manually-adding-Async-on-each-script-Source-Async-JS.png 1530w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Manually-adding-Async-on-each-script-Source-Async-JS-310x121.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Manually-adding-Async-on-each-script-Source-Async-JS-768x301.png 768w\" sizes=\"(max-width: 1530px) 100vw, 1530px\" \/><figcaption class=\"wp-element-caption\">Manually adding Async on each script- Source: Async JS<\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/wp-asset-clean-up\/\">Asset Clean Up<\/a> defers combined JavaScript files by applying \u201cdefer\u201d attribute to the script tags.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1177\" height=\"636\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Asset-clean-up-.png\" alt=\"Deferring JS with Asset clean-up \n\" class=\"wp-image-4130497\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Asset-clean-up-.png 1177w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Asset-clean-up--310x168.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Asset-clean-up--768x415.png 768w\" sizes=\"(max-width: 1177px) 100vw, 1177px\" \/><figcaption class=\"wp-element-caption\">Deferring JS with Asset clean-up&nbsp;<br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\">Autoptimize<\/a> also offers the option to defer parsing your scripts.<\/li><\/ul><p>In the plugin\u2019s settings page, check the \u201cIndividual JS files will be minified and deferred\u201d box. Your non-essential scripts will be deferred.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1063\" height=\"531\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize.png\" alt=\"Deferring JS with Autoptimize\n\" class=\"wp-image-4130504\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize.png 1063w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize-310x155.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize-768x384.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize-120x60.png 120w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-JS-with-Autoptimize-180x90.png 180w\" sizes=\"(max-width: 1063px) 100vw, 1063px\" \/><figcaption class=\"wp-element-caption\">Deferring JS with Autoptimize<br><\/figcaption><\/figure><h3 class=\"wp-block-heading\">How to Load Javascript only on Specific Page in WordPress&nbsp;(with a Plugin)<\/h3><p>\u26a0\ufe0f Some scripts should not be necessarily deferred or you may want to load JS only on a specific page.&nbsp;<\/p><p><a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> has the largest automatic exclusions for JavaScript deferring than any other performance plugins. It allows you to exclude a single file, a group of files, an externally hosted file, and even a minified file.&nbsp;<\/p><p>You can also add any exclusion manually and use a dedicated field in the settings to exclude some URLs of JavaScript files:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"860\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket.png\" alt=\"Possibility to exclude an URL when deferring JS- Source: WP Rocket\n\" class=\"wp-image-4130511\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket.png 934w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket-212x195.png 212w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket-768x707.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket-65x60.png 65w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Possibility-to-exclude-an-URL-when-deferring-JS-Source-WP-Rocket-98x90.png 98w\" sizes=\"(max-width: 934px) 100vw, 934px\" \/><figcaption class=\"wp-element-caption\">Possibility to exclude an URL when deferring JS- Source: WP Rocket<br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">How Deferring Parsing of Javascript Makes Your Site Faster<\/h2><p>For this section, I\u2019m going to use Lighthouse to conduct a performance audit on my mobile site.<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td>If you are not too familiar with Lighthouse, you should read our full guide about <a href=\"https:\/\/wp-rocket.me\/blog\/improve-lighthouse-performance-score-wordpress\/\">improving the Lighthouse performance score on WordPress.&nbsp;<\/a><\/td><\/tr><\/tbody><\/table><\/figure><p>I\u2019ll compare my page speed before vs after deferring the parsing of Javascript.&nbsp;<\/p><p>To defer parsing of JS, I\u2019ll use <strong>WP Rocket <\/strong>\u2014 one of the <a href=\"https:\/\/wp-rocket.me\/best-wordpress-caching-plugin\/\">best cache and performance plugins<\/a> available on the market.<\/p><ul class=\"wp-block-list\"><li>I\u2019ll run the audit against the following KPIs:<ul class=\"wp-block-list\"><li>Overall speed&nbsp;<\/li>\n\n<li>Core Web Vitals&nbsp;<\/li>\n\n<li>Other metrics like <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/improve-speed-index\/\">Speed Index<\/a>, <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/improve-time-to-interactive\/\">Time to Interactive<\/a>, and <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/reduce-total-blocking-time\/\">Total Blocking Time&nbsp;<\/a><\/li><\/ul><\/li><\/ul><ul class=\"wp-block-list\"><li>I\u2019ll also check which Javascript warnings are flagged by PageSpeed before and after the optimization.<\/li><\/ul><ul class=\"wp-block-list\"><li>Two scenarios will be run:<ul class=\"wp-block-list\"><li>#1 <a href=\"#test-1\">Performance test without WP Rocket<\/a><\/li>\n\n<li>#2 <a href=\"#test-2\">Performance test with WP Rocket + \u201cload JS deferred\u201d option activated&nbsp;<\/a><\/li><\/ul><\/li><\/ul><p>Let\u2019s get to the data!<\/p><h3 class=\"wp-block-heading\" id=\"test-1\">#1 Performance Test without WP Rocket<\/h3><p>Without WP Rocket, my overall grade is 43\/100 &#8211; putting my performance in the red according to Lighthouse.&nbsp;<\/p><p>One of my Core Web Vitals is in very bad shape: the Largest Contentful paint is 14.2 s! The Time to Interactive is high (13.4 s), and the same goes for the Speed Index (12.0 s).&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1075\" height=\"798\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed.png\" alt=\"Defer parsing of JS not enabled - Source: PageSpeed\n\" class=\"wp-image-4130522\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed.png 1075w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed-263x195.png 263w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed-768x570.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed-81x60.png 81w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Defer-parsing-of-JS-not-enabled-Source-PageSpeed-121x90.png 121w\" sizes=\"(max-width: 1075px) 100vw, 1075px\" \/><figcaption class=\"wp-element-caption\">Defer parsing of JS not enabled &#8211; Source: PageSpeed<br><\/figcaption><\/figure><p>On top of that, PageSpeed flagged several JS-related issues, as you can see in the figure below:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1086\" height=\"828\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Issues-that-could-be-solved-by-deferring-parsing-of-JS-Source-PageSpeed.png\" alt=\"Issues that could be solved by deferring parsing of JS - Source: PageSpeed\n\" class=\"wp-image-4130530\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Issues-that-could-be-solved-by-deferring-parsing-of-JS-Source-PageSpeed.png 1086w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Issues-that-could-be-solved-by-deferring-parsing-of-JS-Source-PageSpeed-256x195.png 256w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Issues-that-could-be-solved-by-deferring-parsing-of-JS-Source-PageSpeed-768x586.png 768w\" sizes=\"(max-width: 1086px) 100vw, 1086px\" \/><figcaption class=\"wp-element-caption\">Issues that could be solved by deferring parsing of JS &#8211; Source: PageSpeed<br><\/figcaption><\/figure><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Note: <\/strong>To improve performance, you may also consider <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/remove-unused-javascript\/\">removing unused JavaScript<\/a> and minifying it. Anything towards the optimization of your Javascript will be beneficial for <a href=\"https:\/\/wp-rocket.me\/blog\/guide-to-page-speed-optimization-for-wordpress\/\">page speed optimization<\/a>.&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\" id=\"test-2\">#2 \ud83d\ude80 Performance Test with WP Rocket + \u201cLoad JS deferred\u201d Option Activated&nbsp;<\/h3><p>I\u2019ve now activated <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> and checked the \u201cLoad JavaScript deferred\u201c option available from the files optimization tab:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"304\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Load-JavaScript-deferred-in-one-click-with-WP-Rocket.png\" alt=\"\u201cLoad JavaScript deferred\u201c in one click with WP Rocket\" class=\"wp-image-4130540\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Load-JavaScript-deferred-in-one-click-with-WP-Rocket.png 942w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Load-JavaScript-deferred-in-one-click-with-WP-Rocket-310x100.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Load-JavaScript-deferred-in-one-click-with-WP-Rocket-768x248.png 768w\" sizes=\"(max-width: 942px) 100vw, 942px\" \/><figcaption class=\"wp-element-caption\">\u201cLoad JavaScript deferred\u201c in one click with WP Rocket<\/figcaption><\/figure><p>Thanks to WP Rocket, my overall grade is now green. <strong>I\u2019m scoring a 99\/100 score on mobile. <\/strong>All my Core Web Vitals are in good shape, and the rest of my metrics have significantly improved:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1093\" height=\"818\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed.png\" alt=\"Deferring parsing of JS with WP Rocket - Source: PageSpeed\n\" class=\"wp-image-4130548\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed.png 1093w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-261x195.png 261w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-768x575.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-80x60.png 80w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-120x90.png 120w\" sizes=\"(max-width: 1093px) 100vw, 1093px\" \/><figcaption class=\"wp-element-caption\">Deferring parsing of JS with WP Rocket &#8211; Source: PageSpeed<br><\/figcaption><\/figure><p>The passed audit section also looks much better, and WP Rocket fixed the JS-related issues on PageSpeed:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1132\" height=\"424\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Passed-audits-by-deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed.png\" alt=\"Passed audits by deferring parsing of JS with WP Rocket - Source: PageSpeed\n\" class=\"wp-image-4130556\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Passed-audits-by-deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed.png 1132w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Passed-audits-by-deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-310x116.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Passed-audits-by-deferring-parsing-of-JS-with-WP-Rocket-Source-PageSpeed-768x288.png 768w\" sizes=\"(max-width: 1132px) 100vw, 1132px\" \/><figcaption class=\"wp-element-caption\">Passed audits by deferring parsing of JS with WP Rocket &#8211; Source: PageSpeed<br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">Wrapping up<\/h2><p>In conclusion, there are two ways to defer parsing of Javascript in WordPress:<\/p><ul class=\"wp-block-list\"><li>Adding the defer or async attribute manually into your script tags<\/li>\n\n<li>Use a WordPress plugin&nbsp;<\/li><\/ul><p>As a reminder, the <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> plugin added the defer script automatically on the critical content and allowed us to pass the Lighthouse performance audit:&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td>Performance without WP Rocket<br>(JS parsing is not deferred)&nbsp;<\/td><td>\ud83d\ude80 Performance when WP Rocket defers parsing of JS<\/td><\/tr><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/_pSPiNP9LTt70ELsF3zxYGPzkCwMM1DX3I2gPCxmmalaEiW4MKt9E1RhLAGY5U5XGNdJtrm3nBkFQlztH2B0el78CB-GZ3b4qPI0MGugvAImIbi4n6zK2mid4Skci5PTOdQwljTr\" width=\"286\" height=\"219\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/6rCYg04JckGqMr2SjaTWl2GI8QhuInuaRA6SGFcXYrnoUAnHrxoUfJhBGSHnyxhVw0Njmk82_ggdDf-y0sBUHmOKQ2U8m_nog1QsxJySLPE5w0X3_oKoi0ePP17plHoZvWToSowa\" width=\"286\" height=\"107\"><\/td><\/tr><\/tbody><\/table><\/figure><p>A last piece of advice would be <strong>to always check the front end of your site<\/strong> after using the defer tag manually or via any of the WordPress plugins. The goal is to make sure that deferring certain scripts hasn\u2019t broken the above-the-fold content.&nbsp;<\/p><p><strong>Reminder:<\/strong> what to do if a JavaScript script is broken after deferring it?<\/p><p><strong>Answer: <\/strong>simply<strong> <\/strong>add the script you want to exclude from deferring in the following WP Rocket settings:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1656\" height=\"628\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1.png\" alt=\"Loading Javascript only on a specific page with WP Rocket\n\" class=\"wp-image-4130565\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1.png 1656w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1-310x118.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1-768x291.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1-158x60.png 158w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/02\/Loading-Javascript-only-on-a-specific-page-with-WP-Rocket-1-237x90.png 237w\" sizes=\"(max-width: 1656px) 100vw, 1656px\" \/><figcaption class=\"wp-element-caption\">Loading Javascript only on a specific page with WP Rocket<br><\/figcaption><\/figure><p>\ud83d\ude80 WP Rocket is one of the best plugins to defer parsing of Javascript in WordPress. If you don\u2019t feel like editing your functions.php file or adding any extra code, then let <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> do the job for you. No risks taken: you are covered by the money-back guarantee within 14 days of purchase.&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here&#8217;s what you should do.<\/p>\n","protected":false},"author":188114,"featured_media":1850963,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"kia_subtitle":"","footnotes":""},"categories":[63],"tags":[],"class_list":["post-1850917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-cache"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)<\/title>\n<meta name=\"description\" content=\"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here&#039;s what you should do.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)\" \/>\n<meta property=\"og:description\" content=\"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here&#039;s what you should do.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Rocket\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-21T12:20:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-04T15:06:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"460\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Marine Larmier\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wp_rocket\" \/>\n<meta name=\"twitter:site\" content=\"@wp_rocket\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marine Larmier\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\"},\"author\":{\"name\":\"Marine Larmier\",\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/person\/ad9f21665968e3071cede8110604959a\"},\"headline\":\"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)\",\"datePublished\":\"2022-02-21T12:20:00+00:00\",\"dateModified\":\"2024-06-04T15:06:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\"},\"wordCount\":2844,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/wp-rocket.me\/#organization\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png\",\"articleSection\":[\"Page speed and caching\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\",\"url\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\",\"name\":\"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)\",\"isPartOf\":{\"@id\":\"https:\/\/wp-rocket.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png\",\"datePublished\":\"2022-02-21T12:20:00+00:00\",\"dateModified\":\"2024-06-04T15:06:30+00:00\",\"description\":\"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here's what you should do.\",\"breadcrumb\":{\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage\",\"url\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png\",\"contentUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png\",\"width\":1100,\"height\":460,\"caption\":\"Defer Parsing of JavaScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wp-rocket.me\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Page speed and caching\",\"item\":\"https:\/\/wp-rocket.me\/blog\/wordpress-cache\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wp-rocket.me\/#website\",\"url\":\"https:\/\/wp-rocket.me\/\",\"name\":\"WP Rocket\",\"description\":\"Plugin d&#039;optimisation de sites WordPress\",\"publisher\":{\"@id\":\"https:\/\/wp-rocket.me\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wp-rocket.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/wp-rocket.me\/#organization\",\"name\":\"WP Rocket\",\"url\":\"https:\/\/wp-rocket.me\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png\",\"contentUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png\",\"width\":150,\"height\":41,\"caption\":\"WP Rocket\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829\",\"https:\/\/x.com\/wp_rocket\",\"https:\/\/www.youtube.com\/channel\/UC1ozThXHd1IWIZ5wkshgp_Q\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/person\/ad9f21665968e3071cede8110604959a\",\"name\":\"Marine Larmier\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0a77fe97a09a2f3875dbeb05e59c757f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0a77fe97a09a2f3875dbeb05e59c757f?s=96&d=mm&r=g\",\"caption\":\"Marine Larmier\"},\"description\":\"I have six years of experience writing and producing rich SEO content in the WordPress ecosystem. I worked remotely for four years at WPML while traveling the world. Based between France and New Zealand, I love traveling, yoga, sunsets, and world cuisine.\",\"sameAs\":[\"https:\/\/wp-rocket.me\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)","description":"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here's what you should do.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)","og_description":"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here's what you should do.","og_url":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/","og_site_name":"WP Rocket","article_publisher":"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829","article_published_time":"2022-02-21T12:20:00+00:00","article_modified_time":"2024-06-04T15:06:30+00:00","og_image":[{"width":1100,"height":460,"url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png","type":"image\/png"}],"author":"Marine Larmier","twitter_card":"summary_large_image","twitter_creator":"@wp_rocket","twitter_site":"@wp_rocket","twitter_misc":{"Written by":"Marine Larmier","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#article","isPartOf":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/"},"author":{"name":"Marine Larmier","@id":"https:\/\/wp-rocket.me\/#\/schema\/person\/ad9f21665968e3071cede8110604959a"},"headline":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)","datePublished":"2022-02-21T12:20:00+00:00","dateModified":"2024-06-04T15:06:30+00:00","mainEntityOfPage":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/"},"wordCount":2844,"commentCount":6,"publisher":{"@id":"https:\/\/wp-rocket.me\/#organization"},"image":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png","articleSection":["Page speed and caching"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/","url":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/","name":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)","isPartOf":{"@id":"https:\/\/wp-rocket.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage"},"image":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png","datePublished":"2022-02-21T12:20:00+00:00","dateModified":"2024-06-04T15:06:30+00:00","description":"Need to know how to defer parsing of JavaScript and improve performance and your PageSpeed Insights score? Here's what you should do.","breadcrumb":{"@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#primaryimage","url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png","contentUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/wp-rocket-defer-parsing-of-javascript.png","width":1100,"height":460,"caption":"Defer Parsing of JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/wp-rocket.me\/blog\/deferred-loading-of-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wp-rocket.me"},{"@type":"ListItem","position":2,"name":"Page speed and caching","item":"https:\/\/wp-rocket.me\/blog\/wordpress-cache\/"},{"@type":"ListItem","position":3,"name":"How to Defer Parsing of JavaScript in WordPress (Manually and with a Plugin)"}]},{"@type":"WebSite","@id":"https:\/\/wp-rocket.me\/#website","url":"https:\/\/wp-rocket.me\/","name":"WP Rocket","description":"Plugin d&#039;optimisation de sites WordPress","publisher":{"@id":"https:\/\/wp-rocket.me\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wp-rocket.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wp-rocket.me\/#organization","name":"WP Rocket","url":"https:\/\/wp-rocket.me\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/","url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png","contentUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png","width":150,"height":41,"caption":"WP Rocket"},"image":{"@id":"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829","https:\/\/x.com\/wp_rocket","https:\/\/www.youtube.com\/channel\/UC1ozThXHd1IWIZ5wkshgp_Q"]},{"@type":"Person","@id":"https:\/\/wp-rocket.me\/#\/schema\/person\/ad9f21665968e3071cede8110604959a","name":"Marine Larmier","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0a77fe97a09a2f3875dbeb05e59c757f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0a77fe97a09a2f3875dbeb05e59c757f?s=96&d=mm&r=g","caption":"Marine Larmier"},"description":"I have six years of experience writing and producing rich SEO content in the WordPress ecosystem. I worked remotely for four years at WPML while traveling the world. Based between France and New Zealand, I love traveling, yoga, sunsets, and world cuisine.","sameAs":["https:\/\/wp-rocket.me\/"]}]}},"_links":{"self":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/posts\/1850917"}],"collection":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/users\/188114"}],"replies":[{"embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/comments?post=1850917"}],"version-history":[{"count":0,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/posts\/1850917\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/media\/1850963"}],"wp:attachment":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/media?parent=1850917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/categories?post=1850917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/tags?post=1850917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}