There are many things I like about the WordPress blogging software, and many things I find irritating. The most annoying aspect is that WordPress insists that its way is the best and there shall be no deviance. That means a lot of forced cruft being injected into my site. Headers that bloat my page size, Gutenberg stuff I've no use for, and ridiculous editorial decisions.
To double-down on the annoyance, there's no simple way to turn them off. In part, that is due to the "WordPress Philosophy":
Decisions, not options
[…] Every time you give a user an option, you are asking them to make a decision. When a user doesn’t care or understand the option this ultimately leads to frustration.
I broadly agree with that. Having hundreds of options is a burden for users and a nightmare for maintainers. Do please read this excellent discussion from Tom McFarlin for a more detailed analysis.
But I want to turn things off. Luckily, there is a way. If you're a developer, you can remove a fair number of these "enforced" decisions. Add the following to your theme's functions.php file and watch the mandatory WordPress bloat whither away. I've commented each removal and, where possible, given a source for more information. Feel free to leave a comment suggesting how this script can be improved and simplified.
PHP
// 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" ); // Remove WP Emoji. // http://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" ); // 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 ); // No idea why this is separate remove_filter( "the_content", "do_blocks", 9 ); }, 11); // 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 ); // 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" ); // Remove Unused Plugin code. function remove_plugin_css_js() { wp_dequeue_style( "image-sizes" ); } add_action( "wp_enqueue_scripts", "remove_plugin_css_js", 100 ); // 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 ); // 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 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 );
You can find the latest version of my debloat script in my theme's repo.
If there are other things you find helpful to remove, or a better way to organise this file, please drop a comment in the box.
13 thoughts on “A big list of things I disable in WordPress”
Well, your PageSpeed Insights score are excellent, no small feat when running on WordPress, so you must be doing something right...
@Edent Thank you, this is very helpful
| Reply to original comment on social.chinwag.org
@Edent That's a good list. Not sure that I would remove everything on there, but a lot of good snippets. Thx for sharing 👍
| Reply to original comment on infosec.exchange
@Edent YES! Thank you. Gonna dig through these today. Thanks for sharing.
| Reply to original comment on phpc.social
@Edent @davidgerard I'm on the same boat. Mine is bigger/messier[1]. I decided to jump ship and move to ClassicPress, which seems a WordPress without WordPress annoying stuff. That's my big project for 2026 Q1.
[1] https://github.com/manualdousuario/dez/blob/main/functions.php
dez/functions.php at main · manualdousuario/dez
| Reply to original comment on mastodon.social
Excellent tips. Many of these I do for myself, but I never thought to explicitly publish them; thanks for putting them somewhere I can point/refer to!
I actually used quite a similar setup as a plugin. Along with XMLRPC, disabling editing files from the UI, forcing updates on, removing shit from the admin bar, adding useful shortcuts to the admin bar and unregistering all of the default crap that get's loaded. It's really surprising how much effort goes into just trusting the site owner to implement a theme that takes into consideration what the page needs.
@Edent Reading with interest. Thank you.
| Reply to original comment on glammr.us
Guillaume
What a useful script ! Thanks for that, cleaner and cleaner WordPress get better and better 😉
◢ #unknownews ◣Jeśli jesteś technologicznym geekiem i szukasz prezentu na święta (być może dla siebie...), to koniecznie rzuć okiem na stronę sponsora tego wydania.1) Smartfony z Korei Północnej -...
| Reply to original comment on news.mrugalski.pl
This reading list is courtesy of Vivaldi browser, who pay me decent money to fight for a better web and don’t moan at me for reading all this stuff. We’ve just released Vivaldi 7.7 for desktop and mobile, with features requested by our users instead of planet-burning plagiarism-filled Generative AI. The Performance Inequality Gap, 2026 […]
| Reply to original comment on brucelawson.co.uk
More comments on Mastodon.
Trackbacks and Pingbacks
[…] A big list of things I disable in WordPress and nickable code by Tezza […]
[…] un dev qui en avait marre de voir son code source ressembler à un plat de spaghetti, a compilé une petite liste de tout ce qu’on peut virer […]