• Resolved felcerreia

    (@felcerreia)


    Hi, I think this plugin should have the option to automatically add the CDN url to the dns-prefetch. I believe that will be a better solution than editing the functions.php

    It’s seems to be really easy, maybe a function like this.

    add_filter( 'wp_resource_hints',
    	array(
            __CLASS__,
            'add_dns_prefetch'
        ), 10, 2 );
    
    public static function add_dns_prefetch( $hints, $relation_type ) {
    	$options = self::get_options();
    	//Check options here?
    	if ( 'dns-prefetch' === $relation_type ) {
    	    $hints[] = $options['url'];
    	}
    	return $hints;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add DNS Prefetch’ is closed to new replies.