At https://core.trac.wordpress.org/changeset/37920 it defines the
wp_resource_hints() function that was added with WordPress 4.6.
On that page it shows a section of the general-template.php file where the
wp_resource_hints() function is defined, and there's also a function called
wp_resource_hints_scripts_styles() which "Adds dns-prefetch for all scripts and styles enqueued from external hosts."
I would like to replace "dns-prefetch" with "preconnect" for all external enqueued scripts and styles. In other words, I would like the
wp_resource_hints_scripts_styles() function to use "preconnect" somehow.
Is there a way I can modify the
wp_resource_hints() function to achieve this?
I'm looking at the following part of the function, where "dns-prefetch" points to
wp_resource_hints_scripts_styles(), and I'm wondering if that can be changed to use "preconnect" instead:
$hints = array( 'dns-prefetch' => wp_resource_hints_scripts_styles(), 'preconnect' => array( 's.w.org' ), 'prefetch' => array(), 'prerender' => array(), );
Apologies if I haven't worded this question in the clearest way!