Disable Embeds Without Plugin in WordPress

Disabling Embeds Without Plugin is an easy way to speed up your WordPress site by removing scripts you don’t need. In this quick guide, learn how to disable embeds manually and keep your site lean.

Step 1: Add the Embed Disable Code

Add this to your child theme’s functions.php:


// Disable embeds in WordPress
function qdt_disable_embeds() {
remove_action( ‘rest_api_init’, ‘wp_oembed_register_route’ );
remove_filter( ‘oembed_dataparse’, ‘wp_filter_oembed_result’, 10 );
remove_action( ‘wp_head’, ‘wp_oembed_add_discovery_links’ );
remove_action( ‘wp_head’, ‘wp_oembed_add_host_js’ );
}
add_action( ‘init’, ‘qdt_disable_embeds’ );

Why This Matters:

WordPress auto-loads embed scripts for oEmbed support. If you don’t use it, these scripts slow down your site.

Common Mistake:

Make sure you place this inside a child theme. Never edit the parent theme directly.

Pro Tip:

After disabling embeds, test if you still need oEmbed for YouTube or Twitter. Many themes add it back via other scripts.

Related Snippet:

If you found this helpful, check out my guide on how to Disable Emojis Without Plugin in WordPress. Want more speed? Read my guide on how to Disable Emojis Without Plugin in WordPress.

Leave a Comment