Resource Hints in WordPress 4.6

WordPress 4.6 Release Candidate

Many of the changes in the forthcoming WordPress 4.6 are developer-focused changes that take place under the hood. You can test your plugins, themes, and sites with WordPress 4.6 before the release. WordPress have published 4 version 4.6 Beta to made a few refinements before releasing WordPress 4.6 on Tuesday, August 16.
To test WordPress 4.6, you can use the WordPress Beta Tester plugin or you can download the release candidate here (zip). For more information about what’s new in version 4.6, check out the Beta 1Beta 2,Beta 3, and Beta 4 blog posts.
And If you haven’t tested 4.6 yet, now is the time!

Resource Hints in WordPress 4.6

Resource Hints is a W3C specification that defines the dns-prefetch, preconnect, prefetch, and prerender relationships of the HTML Link Element (<link>). These can be used to assist the browser in the decision process of which origins it should connect to, and which resources it should fetch and preprocess to improve page performance. In 4.6, WordPress adds an API to register and use resource hints.
By default, wp_resource_hints() prints hints for s.w.org (the WordPress.org CDN) and for all scripts and styles which are enqueued from external hosts.
Developers can use the wp_resource_hints filter to add custom domains and URLs for dns-prefetch, preconnect, prefetch or prerender. Here is how the filter works:

 

Leave a Reply

Your email address will not be published. Required fields are marked *