{"id":4721391,"date":"2022-09-06T16:18:04","date_gmt":"2022-09-06T14:18:04","guid":{"rendered":"https:\/\/wp-rocket.me\/?post_type=core_web_vitals_hub&#038;p=4721391"},"modified":"2022-09-20T12:20:19","modified_gmt":"2022-09-20T10:20:19","slug":"preconnect-to-required-origins","status":"publish","type":"core_web_vitals_hub","link":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/","title":{"rendered":"How to Preconnect to Required Origins on WordPress"},"content":{"rendered":"<p>Are you wondering what \u201cPreconnect to required origins on WordPress\u201d means on your Lighthouse\u2019s report? Preconnect is a way to tell your browser that you\u2019ll be needing resources from an external website pretty soon.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"244\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png\" alt=\"Lighthouse (PageSpeed Insights) report for Preconnect -  Source: PSI\" class=\"wp-image-4721404\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI--310x95.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI--768x234.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI--190x58.png 190w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI--295x90.png 295w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Lighthouse (PageSpeed Insights) report for Preconnect &#8211;&nbsp; Source: <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/\">PSI<\/a><\/figcaption><\/figure><p><br><a href=\"https:\/\/wp-rocket.me\/blog\/preload-prefetch-preconnect-speed-site-browser-resource-hints\/\">Preconnect<\/a> establishes an earlier connection to third-party domains, reducing the 3rd party code&#8217;s impact on performance. <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/\">Lighthouse is an effective performance tool<\/a> that tells you which key requests are not using the Preconnect hint (&lt;link rel=&#8221;preconnect&#8221;&gt;) yet.&nbsp;<\/p><p>In this article, you\u2019ll learn what Preconnect is, its impact on performance, and how to add the Preconnect hint to the right third-party domains. At the very end, we\u2019ll also share the best WordPress plugins you can use to initiate Preconnect on your website.&nbsp;<\/p><h2 class=\"wp-block-heading\">What Is Preconnect?<\/h2><p>A Preconnect (&lt;link rel=&#8221;preconnect&#8221;&gt;) hint informs the browser to make a proactive and early connection to third-party domains. It means that your page intends to establish a connection to another origin and that you want to launch the process as soon as possible. This can save visitors time downloading a page by eliminating unessential data round trips between the browser and the server.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket.png\" alt=\"Preconnect explained - Source: WP Rocket \n\" class=\"wp-image-4721418\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket-260x195.png 260w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket-768x576.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket-80x60.png 80w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-explained-Source-WP-Rocket-120x90.png 120w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Preconnect explained &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/\">WP Rocket&nbsp;<\/a><br><\/figcaption><\/figure><p>For example, adding Preconnect to an external domain looks like this:&nbsp;<\/p><pre class=\"wp-block-code\"><code class=\"\">&lt;link rel=\"preconnect\" href=\"https:\/\/adomain.com\"&gt;<\/code><\/pre><p>When using \u201cpreconnect\u201d, the browser knows that the page intends to connect to adomain.com. It can get started to retrieve content from there as soon as possible.&nbsp;<\/p><p>To tell the browser to which domain it should connect, you need to identify which third-party domains are involved first.&nbsp;<\/p><h3 class=\"wp-block-heading\">What Are Third-party Domains?<\/h3><p>Third-party domains that should be set as preconnected are YouTube videos, CDNs, Image CDNs, Web fonts, Facebook Connect, or popular stats tools like Google Analytics.&nbsp;<\/p><p>For example, adding Preconnect on a Google font should look like this:&nbsp;<\/p><pre class=\"wp-block-code\"><code class=\"\">&lt;link rel=\"preconnect\" href=\"https:\/\/fonts.gstatic.com\" crossorigin&gt;\n<\/code><\/pre><p><a href=\"https:\/\/www.viget.com\/articles\/make-your-site-faster-with-preconnect-hints\/\">Viget.com<\/a> runs an interesting performance comparison with and without using a Preconnect hint on the Google fonts. When using Preconnect (on the second waterfall chart), we saw three major improvements:<\/p><ul class=\"wp-block-list\"><li>The page was rendered faster.<\/li><li>Three round trips were removed from the critical rendering path.<\/li><li>The latency was cut by more than a half second.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_.png\" alt=\"Waterfall charts with and without Preconnect on Google Fonts - Source: Viget.com\n\" class=\"wp-image-4721429\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_-260x195.png 260w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_-768x576.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_-80x60.png 80w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Waterfall-charts-with-and-without-Preconnect-on-Google-Fonts-Source-Viget.com_-120x90.png 120w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Waterfall charts with and without Preconnect on Google Fonts &#8211; Source: <a href=\"https:\/\/www.viget.com\/articles\/make-your-site-faster-with-preconnect-hints\/\">Viget.com<\/a><br><\/figcaption><\/figure><h3 class=\"wp-block-heading\">How to Identify the 3rd Party Domain to Preconnect<\/h3><p>To Preconnect to the origin on WordPress, you need to identify the 3rd-party domains you need to \u201cPreconnect\u201d. Lighthouse and Chrome Dev tools efficiently help you identify third-party domains.&nbsp;<\/p><p><strong>Using Lighthouse and the \u201cMinimize-third party usage\u201d tab:&nbsp;<\/strong><\/p><p>\u200b\u200bThe Lighthouse Third-party usage audit shows a list of the third-party providers a page uses:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"557\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI-.png\" alt=\"Third-party usage - Source: PSI\n\" class=\"wp-image-4721440\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI--280x195.png 280w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI--768x535.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI--86x60.png 86w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-usage-Source-PSI--129x90.png 129w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Third-party usage &#8211; Source: <a href=\"https:\/\/pagespeed.web.dev\/report?url=https%3A%2F%2Felementor.com%2F&amp;hl=en\">PSI<\/a><br><\/figcaption><\/figure><p><strong>Using Google Chrome Dev Tools:<\/strong><\/p><p>Google Dev Tools also tells you which third-party domains your website is currently using:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"646\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools.png\" alt=\"Third-party domains - Source: Google Chrome Dev Tools\n\" class=\"wp-image-4721447\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools-241x195.png 241w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools-768x620.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools-74x60.png 74w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Third-party-domains-Source-Google-Chrome-Dev-Tools-111x90.png 111w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Third-party domains &#8211; Source: Google Chrome Dev Tools<br><\/figcaption><\/figure><h3 class=\"wp-block-heading\">The Golden Rules:&nbsp;Should I Preconnect This Domain or Not?&nbsp;<\/h3><p>When you should use Preconnect:&nbsp;<\/p><ul class=\"wp-block-list\"><li>When you are confident that assets will be requested from a particular host.<\/li><li>When domains are discovered later in the waterfall.<\/li><li>When domains come with critical resources for rendering the page.<\/li><li>When domains have a lot of contents and requests.<\/li><\/ul><p>When you should not use Preconnect:<\/p><ul class=\"wp-block-list\"><li>When you are loading content below the fold.<\/li><li>When you are delaying the content.<\/li><\/ul><p><em>Be careful not to Preconnect to too many origins; this may cause a high bandwidth consumption. Preconnect only to domains that will be used on the page.&nbsp;<\/em><\/p><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>\ud83d\udca1Pro Tip Optimization:&nbsp;<\/strong>The rules need to be tailored for each website. We recommend using the following process and picking the best approach for you:&nbsp;<br><br>1. Look at your third-party code report<br>2. Add \u201cPreconnect\u201d to the domains&nbsp;<br>3. Test your performance results before and after&nbsp;<br>4. Monitor&nbsp;<br>5. Adjust<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\">Preconnect vs Prefetch vs Preload<\/h3><p>You should use \u201cpreconnect\u201d, \u201cDNS-prefetch\u201d or \u201cpreload\u201d hints to establish required connections to external origins as soon as possible. Their common goal is to inform the browser that your website will use specific resources later on.<\/p><p>However, there are a few differences you should know.<\/p><ul class=\"wp-block-list\"><li><strong>Preconnect <\/strong>= prepares connexion to a third-party (external) domain that will be used to download resources. Only for significant resources.&nbsp;<\/li><li><strong>Preload<\/strong> = prioritizes the current page resources.<\/li><li><strong>Prefetch<\/strong> = prepares the next navigation resources.&nbsp;<\/li><\/ul><p>If you are interested in learning more about the hints, have a look at the summary table below listing all the techniques:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"409\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com-.png\" alt=\"Techniques to preload content - Source: En.ryte.com\n\" class=\"wp-image-4721460\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com--310x158.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com--768x393.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com--117x60.png 117w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Techniques-to-preload-content-Source-En.ryte_.com--176x90.png 176w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Techniques to preload content &#8211; Source: <a href=\"https:\/\/en.ryte.com\/magazine\/faster-loading-times-with-prefetch-preload-prerender\">En.ryte.com<\/a><br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">Why Preconnect to Required Origins is Important for Performance<\/h2><p>One of the best ways to improve the performance of your site is to set hints like \u201cPreconnect\u201d. It tells the browser what origins will be used to start establishing all the necessary connections for those resources as soon as possible.<\/p><p>Thanks to Preconnect hints, you can reduce latency and round-trip times and make your site faster.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket-.png\" alt=\"Benefits of using Preconnect (performance impact) - Source: WP Rocket\n\" class=\"wp-image-4721469\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket--260x195.png 260w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket--768x576.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket--80x60.png 80w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Benefits-of-using-Preconnect-performance-impact-Source-WP-Rocket--120x90.png 120w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Benefits of using Preconnect (performance impact) &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/\">WP Rocket<\/a><br><\/figcaption><\/figure><p>Remember that every time a connection is established, it may involve significant loading time and slow networks (especially regarding secure connections).&nbsp;<\/p><p>By using Preconnect, you also improve two major performance metrics established by Google: the <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/\">Largest Contentful Paint (LCP)<\/a>, which is one of the <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/\">Core Web Vitals<\/a>, and the <a href=\"https:\/\/wp-rocket.me\/lighthouse-performance-score-wordpress\/improve-first-contentful-paint\/\">First Contentful Paint (FCP)<\/a>, another interesting user-centric metric used to measure the overall page experience.&nbsp;<\/p><h3 class=\"wp-block-heading\">The Impact of Preconnect on the Largest Contentful Paint and  First Contentful Paint Scores<\/h3><p>Preconnect allows websites to reduce the time it takes to connect to another origin (or another domain). The goal is to reduce the time it takes to load a resource from another origin. As a result, the Preconnect strategy also concerns the Largest Contentful Paint and First Contentful Paint metrics because you can specify the importance of an asset to the browser.&nbsp;<\/p><p>For example, if the browser sees a \u201chigh preconnect\u201d hint on the LCP, it will fetch the LCP asset very early. This is crucial because the Largest Contentful Paint helps Google measure your website&#8217;s user experience. LCP elements are the most important content expected to be seen by the user: a hero image, a video, and so on.&nbsp;<\/p><p>Preconnect also boosts your First Contentful Paint by establishing early network connections resulting in an improved perceived page speed.\u00a0<\/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\">How to Preconnect Manually<\/h2><p>To implement Preconnect manually, simply add the &lt;link&gt; tag to the &lt;head&gt; or the HTTP header of the document (your header.php file):<\/p><pre class=\"wp-block-code\"><code class=\"\">&lt;head&gt;\n   &lt;link rel=\"preconnect\" href=\"https:\/\/athirdpartydomain.com\"&gt;\n&lt;\/head&gt;\n<\/code><\/pre><p>With those tags, you are informing the browser of your intention to prioritize some resources over some others.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"327\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla-.png\" alt=\"\" class=\"wp-image-4721479\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla--310x127.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla--768x314.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla--147x60.png 147w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Dos-and-dont-when-implementing-manually-Preconnect-Source-Mozilla--220x90.png 220w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Do\u2019s and don\u2019t when implementing manually Preconnect &#8211; Source: <a href=\"https:\/\/developer.mozilla.org\/fr\/docs\/Web\/HTTP\/Headers\/Link\">Mozilla<\/a><br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">How to Preconnect with a Plugin<\/h2><p>If you are not comfortable editing manually your code files, you can always use a WordPress plugin to initiate Preconnect. It\u2019s easier and much faster!<\/p><h3 class=\"wp-block-heading\">Using WP Rocket to Implement Preconnect&nbsp;<\/h3><p>One of the best ways to implement Preconnect to the required origin on WordPress is to use the <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> plugin, which also happens to be one of the <a href=\"https:\/\/wp-rocket.me\/best-wordpress-caching-plugin\/\">best caching plugins for WordPress<\/a>.<\/p><p>WP Rocket automatically adds Preconnect in the two cases:&nbsp;<\/p><ul class=\"wp-block-list\"><li>To the CNAME entered on the CDN tab<\/li><li>To optimize Google Fonts &#8211; WP Rocket adds \u201cpreconnect\u201d to the fonts.gstatic.com domain to improve Google fonts loading time.<\/li><\/ul><p>If you need additional third-party domains used on your site, simply add them to the <em>Prefetch DNS Requests<\/em> box from the <em>Preload tab <\/em>in WP Rocket\u2019s WordPress dashboard:&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"346\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket-.png\" alt=\"Prefetch DNS Requests - Source: WP Rocket\n\" class=\"wp-image-4721487\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket--310x134.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket--768x332.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket--139x60.png 139w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Prefetch-DNS-Requests-Source-WP-Rocket--208x90.png 208w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Prefetch DNS Requests &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/\">WP Rocket<\/a><br><\/figcaption><\/figure><p>This way, WP Rocket will add the \u201cdns-prefetch\u201d resource hint to perform an early DNS lookup to important third-party, as it\u2019s requested. <br>Remember: When adding the domains, don&#8217;t use the protocol HTTP\/HTTPS but only the forward slashes \u201c\/\/\u201d. Add all the listed domains, one per line, and that would be it!<\/p><h3 class=\"wp-block-heading\">Other Plugins Available to Implement Preconnect&nbsp;<\/h3><ul class=\"wp-block-list\"><li><a href=\"https:\/\/perfmatters.io\/\">Perfmatters<\/a> (premium) &#8211; lets you reconnect and add the CrossOrigin tags on several domains:<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"613\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters-.png\" alt=\"Preconnect hint - Source: Perfmatters\n\" class=\"wp-image-4721498\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters--254x195.png 254w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters--768x588.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters--78x60.png 78w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnect-hint-Source-Perfmatters--117x90.png 117w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Preconnect hint &#8211; Source: <a href=\"https:\/\/perfmatters.io\/\">Perfmatters<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\">Autoptimize<\/a> &#8211; a performance optimization plugin that comes with the Preconnect advanced feature. It instructs browsers to make a connection to specific domains even if the connection is not immediately needed.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"334\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize.png\" alt=\"Preload specific requests - Source: Autoptimize\n\" class=\"wp-image-4721505\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize-310x129.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize-768x321.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize-144x60.png 144w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preload-specific-requests-Source-Autoptimize-216x90.png 216w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Preload specific requests &#8211; Source: <a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\">Autoptimize<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/wp-asset-clean-up\/\">Asset CleanUp<\/a> &#8211; only lets you Preconnect Google Fonts. The option can be activated from Settings &gt; Google Fonts &gt; Preconnect.<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"163\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp-.png\" alt=\"Preconnecting fonts - Source: Asset CleanUp\n\" class=\"wp-image-4721512\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp--310x63.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp--768x156.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp--190x39.png 190w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Preconnecting-fonts-Source-Asset-CleanUp--442x90.png 442w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Preconnecting fonts &#8211; Source: <a href=\"https:\/\/wordpress.org\/plugins\/wp-asset-clean-up\/\">Asset CleanUp<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wordpress.org\/plugins\/pre-party-browser-hints\/\">Pre* Party Resource Hints<\/a> &#8211; allows users to automatically and easily embed Preconnect hints to improve page load time. It also supports DNS prefetch, prerender, prefetch, and preload.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"527\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint.png\" alt=\"Adding the hint type - Source: Pre*party resources hint\n\" class=\"wp-image-4721519\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint-296x195.png 296w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint-768x506.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint-91x60.png 91w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Adding-the-hint-type-Source-Pre_party-resources-hint-137x90.png 137w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption>Adding the hint type &#8211; Source: <a href=\"https:\/\/wordpress.org\/plugins\/pre-party-browser-hints\/\">Pre*party resources hint<\/a><br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">Wrapping Up<\/h2><p>WordPress plugins like <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> can help you to prioritize which 3rd-party resources you want to load first. It informs the browser what to do with the different origins and makes you save some precious loading time.&nbsp;<\/p><p>Remember, once you have initiated your Preconnect hints, it\u2019s crucial to run a report on Lighthouse to see if there are any errors. Web.dev says that too many Preconnect hints could delay other important resources. That\u2019s why you should always limit the amount of preconnected domains and test the performance before and after adding the hint.&nbsp;<\/p><p>Give <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> a try, preconnect to required origins, and watch the impact on performance. No risks are taken with our 30 days money-back guarantee!<\/p>","protected":false},"excerpt":{"rendered":"<p>Want to understand what &#8220;Preconnect to required origins&#8221; means for your WordPress site? You&#8217;re on the right page! Read our article and learn what you should do to fix the issue.<\/p>\n","protected":false},"template":"","core_web_vitals":[132],"class_list":["post-4721391","core_web_vitals_hub","type-core_web_vitals_hub","status-publish","hentry","core_web_vitals-improve-largest-contentful-paint"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Preconnect to Required Origins on WordPress<\/title>\n<meta name=\"description\" content=\"Want to understand what &quot;Preconnect to required origins&quot; means for your WordPress site? Read our article and learn what you should do to fix the issue.\" \/>\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\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Preconnect to Required Origins on WordPress\" \/>\n<meta property=\"og:description\" content=\"Want to understand what &quot;Preconnect to required origins&quot; means for your WordPress site? Read our article and learn what you should do to fix the issue.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/\" \/>\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:modified_time\" content=\"2022-09-20T10:20:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wp_rocket\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/\",\"url\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/\",\"name\":\"How to Preconnect to Required Origins on WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/wp-rocket.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png\",\"datePublished\":\"2022-09-06T14:18:04+00:00\",\"dateModified\":\"2022-09-20T10:20:19+00:00\",\"description\":\"Want to understand what \\\"Preconnect to required origins\\\" means for your WordPress site? Read our article and learn what you should do to fix the issue.\",\"breadcrumb\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage\",\"url\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png\",\"contentUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png\",\"width\":800,\"height\":244},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wp-rocket.me\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Core Web Vitals\",\"item\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Largest Contentful Paint\",\"item\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Preconnect to Required Origins on WordPress\"}]},{\"@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\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Preconnect to Required Origins on WordPress","description":"Want to understand what \"Preconnect to required origins\" means for your WordPress site? Read our article and learn what you should do to fix the issue.","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\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/","og_locale":"en_US","og_type":"article","og_title":"How to Preconnect to Required Origins on WordPress","og_description":"Want to understand what \"Preconnect to required origins\" means for your WordPress site? Read our article and learn what you should do to fix the issue.","og_url":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/","og_site_name":"WP Rocket","article_publisher":"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829","article_modified_time":"2022-09-20T10:20:19+00:00","og_image":[{"url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png"}],"twitter_card":"summary_large_image","twitter_site":"@wp_rocket","twitter_misc":{"Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/","url":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/","name":"How to Preconnect to Required Origins on WordPress","isPartOf":{"@id":"https:\/\/wp-rocket.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage"},"image":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage"},"thumbnailUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png","datePublished":"2022-09-06T14:18:04+00:00","dateModified":"2022-09-20T10:20:19+00:00","description":"Want to understand what \"Preconnect to required origins\" means for your WordPress site? Read our article and learn what you should do to fix the issue.","breadcrumb":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#primaryimage","url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png","contentUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/09\/Lighthouse-PageSpeed-Insights-report-for-Preconnect-Source-PSI-.png","width":800,"height":244},{"@type":"BreadcrumbList","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/preconnect-to-required-origins\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wp-rocket.me"},{"@type":"ListItem","position":2,"name":"Core Web Vitals","item":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/"},{"@type":"ListItem","position":3,"name":"Largest Contentful Paint","item":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/"},{"@type":"ListItem","position":4,"name":"How to Preconnect to Required Origins on WordPress"}]},{"@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"]}]}},"_links":{"self":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals_hub\/4721391"}],"collection":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals_hub"}],"about":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/types\/core_web_vitals_hub"}],"wp:attachment":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/media?parent=4721391"}],"wp:term":[{"taxonomy":"core_web_vitals","embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals?post=4721391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}