Prune WordPress bloat with my personal checklist. From emoji scripts to Gutenberg styles and RSD links, learn how to keep your site lean without breaking features.
EN

WordPress debloat: 11 targeted fixes i use to slash bloat

5.00 /5 - (12 votes )
Last verified: March 1, 2026
Experience: 5+ years experience
Table of Contents

WordPress is a powerhouse, but its “one size fits all” defaults mean it often ships with baggage most modern projects don’t need. Over the years, I’ve refined a specific set of snippets to trim the fat without compromising the core experience.

This guide isn’t just a list of things to delete; it’s a strategic approach to performance. It’s inspired by Terence Eden’s excellent list, which I’ve paired with my own production-tested solutions.

The case for pruning

Why bother with these small scripts? Because they add up. Every unnecessary line is a potential conflict, a tiny rendering delay, or a wasted byte.

What we’re targeting:

  • DOM Size – Stripping unused inline styles.
  • HTTP Overhead – Dequeuing scripts that shouldn’t be there.
  • Security Surface – Disabling legacy protocols like XML-RPC.
  • Core Web Vitals – Directly impacting LCP and CLS by removing render-blocking fluff.

[!IMPORTANT] Use Caution: Not every “bloat” is useless. If you rely on the classic editor’s specific styling or built-in emojis for older browsers, some of these fixes might not be for you. Test in staging first.

The complete debloating script

Add the following to your theme’s functions.php file. Each section is commented with explanations and source links.

1. Remove classic theme styles

WordPress adds “classic-theme-styles” even on custom themes. Remove them:

//  Remove mandatory classic theme.
function disable_classic_theme_styles() {
    wp_deregister_style( "classic-theme-styles" );
    wp_dequeue_style(    "classic-theme-styles" );
}
add_action( "wp_enqueue_scripts", "disable_classic_theme_styles" );

2. Remove emoji support

WordPress converts text emojis to images and adds detection scripts. If your visitors have emoji support (which all modern browsers do), this is unnecessary:

//  Remove WP Emoji.
//  https://www.denisbouquet.com/remove-wordpress-emoji-code/
remove_action( "wp_head",             "print_emoji_detection_script", 7 );
remove_action( "wp_print_styles",     "print_emoji_styles"              );
remove_action( "admin_print_scripts", "print_emoji_detection_script"    );
remove_action( "admin_print_styles",  "print_emoji_styles"              );
//  https://wordpress.org/support/topic/remove-the-new-dns-prefetch-code/
add_filter( "emoji_svg_url", "__return_false" );

//  Stop emoji replacement with images in RSS / Atom Feeds
//  https://danq.me/2023/09/04/wordpress-stop-emoji-images/
remove_filter( "the_content_feed", "wp_staticize_emoji" );
remove_filter( "comment_text_rss", "wp_staticize_emoji" );

3. Disable automatic text formatting

WordPress “texturizes” your content, converting straight quotes to curly quotes, double hyphens to em-dashes, etc. This can break code samples and isn’t always desired:

//  Remove automatic formatting.
//  https://css-tricks.com/snippets/wordpress/disable-automatic-formatting/
remove_filter( "the_content",  "wptexturize" );
remove_filter( "the_excerpt",  "wptexturize" );
remove_filter( "comment_text", "wptexturize" );
remove_filter( "the_title",    "wptexturize" );

//  More formatting crap.
add_action("init", function() {
    remove_filter( "the_content", "convert_smilies", 20 );
    foreach ( array( "the_content", "the_title", "wp_title", "document_title" ) as $filter ) {
        remove_filter( $filter, "capital_P_dangit", 11 );
    }
    remove_filter( "comment_text", "capital_P_dangit", 31 );
    remove_filter( "the_content",  "do_blocks", 9 );
}, 11);

Note: The capital_P_dangit filter is WordPress’s way of auto-correcting “WordPress” to “WordPress”. It’s aggressive and sometimes unwanted.

4. Remove Gutenberg styles and scripts

If you’re using a custom theme and don’t rely on Gutenberg’s frontend styles, remove them:

//  Remove Gutenberg Styles.
//  https://wordpress.org/support/topic/how-to-disable-inline-styling-style-idglobal-styles-inline-css/
remove_action( "wp_enqueue_scripts", "wp_enqueue_global_styles" );

//  Remove Gutenberg editing widgets.
//  From https://wordpress.org/plugins/classic-widgets/
//  Disables the block editor from managing widgets in the Gutenberg plugin.
add_filter( "gutenberg_use_widgets_block_editor", "__return_false" );
//  Disables the block editor from managing widgets.
add_filter( "use_widgets_block_editor", "__return_false" );

//  Remove Gutenberg Block Library CSS from loading on the frontend.
//  https://smartwp.com/remove-gutenberg-css/
function remove_wp_block_library_css() {
    wp_dequeue_style( "wp-block-library"       );
    wp_dequeue_style( "wp-block-library-theme" );
    wp_dequeue_style( "wp-components"          );
}
add_action( "wp_enqueue_scripts", "remove_wp_block_library_css", 100 );

5. Remove header meta tags

Clean up your <head> section by removing unnecessary meta tags:

//  Remove shortlink.
//  https://stackoverflow.com/questions/42444063/disable-wordpress-short-links
remove_action( "wp_head", "wp_shortlink_wp_head" );

//  Remove RSD.
//  https://wpengineer.com/1438/wordpress-header/
remove_action( "wp_head", "rsd_link" );

//  Remove extra feed links.
//  https://developer.wordpress.org/reference/functions/feed_links/
add_filter( "feed_links_show_comments_feed", "__return_false" );
add_filter( "feed_links_show_posts_feed",    "__return_false" );

//  Remove api.w.org link.
//  https://wordpress.stackexchange.com/questions/211467/remove-json-api-links-in-header-html
remove_action( "wp_head", "rest_output_link_wp_head" );
//  https://wordpress.stackexchange.com/questions/211817/how-to-remove-rest-api-link-in-http-headers
//  https://developer.wordpress.org/reference/functions/rest_output_link_header/
remove_action( "template_redirect", "rest_output_link_header", 11, 0 );

6. Remove image enhancements

WordPress adds sizes attributes and other enhancements to images. If you handle these yourself, remove them:

//  Remove WordPress forced image size
//  https://core.trac.wordpress.org/ticket/62413#comment:40
add_filter( "wp_img_tag_add_auto_sizes", "__return_false" );

//  Remove <img> enhancements
//  https://developer.wordpress.org/reference/functions/wp_filter_content_tags/
remove_filter( "the_content",  "wp_filter_content_tags", 12 );

//  Stop rewriting http:// URLs for the main domain.
//  https://developer.wordpress.org/reference/hooks/wp_should_replace_insecure_home_url/
remove_filter( "the_content", "wp_replace_insecure_home_url", 10 );

//  Remove the attachment stuff
//  https://developer.wordpress.org/news/2024/01/building-dynamic-block-based-attachment-templates-in-themes/
remove_filter( "the_content", "prepend_attachment" );

//  Remove the block filter
remove_filter( "the_content", "apply_block_hooks_to_content_from_post_object", 8 );

7. Remove browser check and other admin features

//  Remove browser check from Admin dashboard.
//  https://core.trac.wordpress.org/attachment/ticket/27626/disable-wp-check-browser-version.0.2.php
if ( !empty( $_SERVER["HTTP_USER_AGENT"] ) ) {
    add_filter( "pre_site_transient_browser_" . md5( $_SERVER["HTTP_USER_AGENT"] ), "__return_null" );
}

//  Remove hovercards on comment links in admin area.
//  https://wordpress.org/support/topic/how-to-disable-mshots-service/#post-12946617
add_filter( "akismet_enable_mshots", "__return_false" );

My additional recommendations

Beyond the techniques above, here are my own solutions for further optimization:

8. Disable XML-RPC

If you don’t use external apps to post to WordPress, disable XML-RPC to improve security:

// Disable XML-RPC entirely
add_filter( 'xmlrpc_enabled', '__return_false' );

// Remove XML-RPC link from head
remove_action( 'wp_head', 'rsd_link' );

9. Remove jquery migrate

Modern WordPress themes and plugins rarely need jQuery Migrate. If your site works without it, remove it:

function remove_jquery_migrate( $scripts ) {
    if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
        $script = $scripts->registered['jquery'];
        if ( $script->deps ) {
            $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
        }
    }
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );

10. Disable oembed

If you don’t embed content from other sites (YouTube, Twitter, etc.), disable oEmbed:

// Remove oEmbed discovery links
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'wp_head', 'wp_oembed_add_host_js' );

// Remove oEmbed REST API endpoint
remove_action( 'rest_api_init', 'wp_oembed_register_route' );

// Disable oEmbed auto discovery
add_filter( 'embed_oembed_discover', '__return_false' );

11. Defer javascript loading

Add defer to non-critical scripts for better performance:

function add_defer_attribute( $tag, $handle ) {
    // Add scripts that should NOT be deferred
    $scripts_to_not_defer = array( 'jquery-core' );
    
    if ( in_array( $handle, $scripts_to_not_defer ) ) {
        return $tag;
    }
    
    return str_replace( ' src', ' defer src', $tag );
}
add_filter( 'script_loader_tag', 'add_defer_attribute', 10, 2 );

Measuring the impact

After implementing these changes, test your site using:

  1. Google PageSpeed Insights – Check your Core Web Vitals
  2. GTmetrix – Detailed waterfall analysis
  3. WebPageTest – Multiple test locations and connection speeds

You should see:

  • Reduced page weight (fewer CSS/JS bytes)
  • Fewer HTTP requests
  • Improved Time to First Byte (TTFB)
  • Better Largest Contentful Paint (LCP)

Conclusion

WordPress’s “batteries included” approach is great for beginners, but developers seeking maximum performance need to trim the fat. The techniques in this guide, inspired by Terence Eden’s excellent debloating script, will help you achieve a leaner, faster WordPress installation.

Remember: less is more. Every line of code you remove is one less potential point of failure, one less byte to download, and one step closer to a perfect PageSpeed score.

What should you know about WordPress debloat: 11 targeted fixes i use to slash bloat?
WordPress debloat: 11 targeted fixes i use to slash bloat is an essential aspect of WordPress website management that helps improve site performance, security, and user experience.
How does WordPress debloat: 11 targeted fixes i use to slash bloat work?
WordPress debloat: 11 targeted fixes i use to slash bloat involves configuring various settings and implementing best practices to optimize your WordPress website.
Why is WordPress debloat: 11 targeted fixes i use to slash bloat important for WordPress?
WordPress debloat: 11 targeted fixes i use to slash bloat is crucial because it directly impacts your website's search engine rankings, loading speed, and overall success.

Need an FAQ tailored to your industry and market? We can build one aligned with your business goals.

Let’s discuss

Related Articles