• Resolved larakim

    (@larakim)


    Hi there. This code has been working for a while, but after the latest update of wordpress, I see that it is prefetching CDN from here cdn.jsdelivr.net
    Its calling emojione.min.css and emojione.min.js. The code I have in my child theme functions is

    /**
     * Disable the emoji's
     */
    function disable_emojis() {
    	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    	remove_action( 'wp_print_styles', 'print_emoji_styles' );
    	remove_action( 'admin_print_styles', 'print_emoji_styles' );	
    	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
    	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );	
    	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
    	add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
    	add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
    }
    add_action( 'init', 'disable_emojis' );
    
    /**
     * Filter function used to remove the tinymce emoji plugin.
     * 
     * @param    array  $plugins  
     * @return   array             Difference betwen the two arrays
     */
    function disable_emojis_tinymce( $plugins ) {
    	if ( is_array( $plugins ) ) {
    		return array_diff( $plugins, array( 'wpemoji' ) );
    	} else {
    		return array();
    	}
    }
    
    /**
     * Remove emoji CDN hostname from DNS prefetching hints.
     *
     * @param  array  $urls          URLs to print for resource hints.
     * @param  string $relation_type The relation type the URLs are printed for.
     * @return array                 Difference betwen the two arrays.
     */
    function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
    
    	if ( 'dns-prefetch' == $relation_type ) {
    
    		// Strip out any URLs referencing the www.remarpro.com emoji location
    		$emoji_svg_url_bit = 'https://s.w.org/images/core/emoji/';
    		foreach ( $urls as $key => $url ) {
    			if ( strpos( $url, $emoji_svg_url_bit ) !== false ) {
    				unset( $urls[$key] );
    			}
    		}
    
    	}
    
    	return $urls;
    }

    It’s the latest from github as far as I can see. Any ideas what happens here? Thank you!!!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Argghh, I never got a notification about your post. I just spotted it now when visiting the plugin page. I’m hectically busy right now, but I’ll look into this for you when I’m free. You’ve been waiting four months, so I guess another couple of days won’t matter :/ Sorry for the delay.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    I didn’t find any reference to that domain name in WordPress at all.

    Perhaps this is being added to your site by some other code?

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    I’ve marked this as resolved since I failed to find any problem. If you can replicate this problem with a blank WordPress install, just reopen the thread and let me know where you found the domain listed, and I will take another look for you.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    I suspect this problem is caused by using the jsdelivr CDN across your whole site, and it’s interfering with the URLs used in the prefetch system and causing the plugin to keep fetching them.

    • This reply was modified 6 years, 8 months ago by Ryan Hellyer.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prefetching CDN again’ is closed to new replies.