Making WordPress.org

Changeset 13674


Ignore:
Timestamp:
05/08/2024 05:10:15 AM (5 months ago)
Author:
dd32
Message:

Plugin Directory: Add resource hints for dns-prefetch.

Fixes #6769.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r13651 r13674  
    5353        add_filter( 'allowed_redirect_hosts', array( $this, 'filter_redirect_hosts' ) );
    5454        add_filter( 'wp_get_attachment_url', array( $this, 'add_info_to_zip_url' ), 100, 2 );
     55
     56        add_filter( 'wp_resource_hints', array( $this, 'wp_resource_hints' ), 10, 2 );
    5557
    5658        // Add no-index headers where appropriate.
     
    18651867        // Append with a anchor, such that CLI environments don't require special handling.
    18661868        return API\Routes\Plugin_Review::append_plugin_review_info_url( $url, $post );
     1869    }
     1870
     1871    /**
     1872     * Add a dns-prefetch for the CDNs we use.
     1873     */
     1874    function wp_resource_hints( $uris, $type ) {
     1875        if ( 'dns-prefetch' === $type ) {
     1876            $uris[] = '//s.w.org';
     1877            $uris[] = '//ps.w.org';
     1878        }
     1879
     1880        return $uris;
    18671881    }
    18681882
Note: See TracChangeset for help on using the changeset viewer.