Support » Plugin: LiteSpeed Cache » Additional optimization for “Remove WordPress Emoji”

  • Resolved luboslives

    (@luboslives)


    I’m looking into trimming down my header, and I noticed this unnecessary line:

    <link rel="dns-prefetch" href="//s.w.org">

    I looked through the source and it seems the only thing that uses this subdomain is the WordPress Emoji script. So if you guys could unload this from the header when we check off “Remove WordPress Emoji”, that would be optimal.

    At quick glance, you might get started by looking at wp_resource_hints() inside wp-includes/general-template.php.

    The only other places it appears is _print_emoji_detection_script() inside wp-includes/formatting.php and $signature_verification inside wp-admin/includes/file.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter luboslives

    (@luboslives)

    Found the filter:

    function remove_wpemoji_prefetch( $urls, $relation_type ) {
    	// s.w.org gets appended as the last entry
    	$lastkey = count( $urls ) - 1;
    	unset( $urls[ $lastkey ] );
    	return $urls;
    }
    add_filter( 'wp_resource_hints', 'remove_wpemoji_prefetch', 0, 2 );

    Looking at wp_resource_hints(), my best guess is that s.w.org gets appended as the last entry in the $urls array, but that might require some testing across different sites connecting to different domains.

    From what I read, WordPress will automatically set up dns-prefetch for every external script passed through wp_enqueue_style or wp_enqueue_script.

    • This reply was modified 2 years, 2 months ago by luboslives.
    Plugin Support Hai Zheng⚡

    (@hailite)

    Good to know. Thanks. Will work on this after v3.1 and update here later.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Additional optimization for “Remove WordPress Emoji”’ is closed to new replies.