Change dns-prefetch to preconnect for external enqueued resources
There’s a filter, wp_resource_hints, but it only filters each “relation type” (i.e. preconnect, dns-prefetch, etc.) individually, rather than the whole $hints array in your question. However, you could use the filter to empty the array for dns-prefetch and add wp_resource_hints_scripts_styles() to the preconnect array, like this: add_filter( ‘wp_resource_hints’, function( $urls, $relation_type ) { if ( … Read more