Make WordPress Core


Ignore:
Timestamp:
08/18/2022 08:43:19 AM (2 years ago)
Author:
audrasjb
Message:

Script Loader: Remove default DNS prefetch entry for s.w.org.

A default DNS prefetch entry for s.w.org was previously included to save a few ms in case an emoji is used that is not supported by the browser. It appears this use case doesn't justify a prefetch to s.w.org on every WordPress website.

This changesets removes emoji_svg_url prefetch from wp_resource_hints(). It also updates unit tests in Tests_General_wpResourceHints by removing test_should_have_defaults_on_frontend() entirely and removing s.w.org prefetch from expected output of ten other test functions.

Plugin authors can use the wp_resource_hints filter if they need to re-add the DNS prefetch entry for s.w.org.

Follow-up to [37920], [38122].

Props joelhardi, superpoincare, jhabdas, garrett-eclipse, sabernhardt, SergeyBiryukov.
Fixes #40426.
See #37387.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r53888 r53904  
    33183318    );
    33193319
    3320     /*
    3321      * Add DNS prefetch for the Emoji CDN.
    3322      * The path is removed in the foreach loop below.
    3323      */
    3324     /** This filter is documented in wp-includes/formatting.php */
    3325     $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/13.0.0/svg/' );
    3326 
    33273320    foreach ( $hints as $relation_type => $urls ) {
    33283321        $unique_urls = array();
Note: See TracChangeset for help on using the changeset viewer.