wp_resource_hints

Filters domains and URLs for resource hints of relation type.

Description

apply_filters( 'wp_resource_hints', (array) $urls, (string) $relation_type ); 

Parameters (2)

0. $urls (array)
URLs to print for resource hints.
1. $relation_type (string)
The relation type the URLs are printed for, e.g. preconnect or prerender..

Usage

To run the hook, copy the example below.
  1. $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type ); 
  2.  
  3. if ( !empty( $urls ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_resource_hints callback 
  2. function filter_wp_resource_hints( $urls, $relation_type ) { 
  3. // make filter magic happen here... 
  4. return $urls
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_resource_hints', 'filter_wp_resource_hints', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_resource_hints', 'filter_wp_resource_hints', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/general-template.php  
  1. $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );