WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/29/2016 07:35:27 PM (5 years ago)
Author:
ocean90
Message:

Script Loader: Introduce an API to register resource hints.

Resource hints allow browsers to prefetch specific pages or render them in the background to perform DNS lookups or to begin the connection handshake (DNS, TCP, TLS) in the background.

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.
Use the wp_resource_hints filter to add custom domains and URLs for dns-prefetch, preconnect, prefetch or prerender.

Props voldemortensen, swissspidy.
Fixes #34292.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/admin-filters.php

    r37619 r37920  
    4343add_action( 'admin_head', 'wp_site_icon'             );
    4444add_action( 'admin_head', '_ipad_meta'               );
     45
     46// Prerendering.
     47add_filter( 'admin_head', 'wp_resource_hints' );
    4548
    4649add_action( 'admin_print_scripts-post.php',     'wp_page_reload_on_back_button_js' );
Note: See TracChangeset for help on using the changeset viewer.