Resource

Disable WP emoji + embeds bloat

functions.php

Drop-in functions.php snippet that removes the WordPress emoji script, embed script, and oEmbed discovery links. -38 KB on every page.

What’s in it

// Disable WP emoji rendering (-12 KB JS).
remove_action( 'wp_head',     'print_emoji_detection_script', 7 );
remove_action( 'wp_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' );

// Disable WP embeds (-22 KB JS).
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
remove_action( 'rest_api_init', 'wp_oembed_register_route' );

// Disable feed links (-4 KB).
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );

License

MIT.