TL;DR
- oEmbed adds discovery requests and loads
wp-embed.json every page. - A small
functions.phpsnippet disables embeds safely. - You can keep embeds in the admin if editors need previews.
What Are WordPress Embeds?
WordPress uses oEmbed to turn plain URLs (YouTube, X/Twitter, Vimeo, etc.) into rich embedded content. It works by making discovery requests and loading wp-embed.js on the front end. If you never embed third‑party content, these requests are just overhead.
Disable Embeds Snippet (functions.php)
This snippet removes embed discovery, the embed script, and related REST/oEmbed routes.
function fyrepress_disable_embeds() {
// Remove the REST API endpoint.
remove_action('rest_api_init', 'wp_oembed_register_route');
// Turn off oEmbed auto discovery.
add_filter('embed_oembed_discover', '__return_false');
// Disable oEmbed discovery links in the head.
remove_action('wp_head', 'wp_oembed_add_discovery_links');
// Remove oEmbed-specific JavaScript from the front end and back end.
remove_action('wp_head', 'wp_oembed_add_host_js');
remove_action('wp_enqueue_scripts', 'wp_oembed_add_host_js');
// Remove the oEmbed filter of the content.
remove_filter('the_content', array($GLOBALS['wp_embed'], 'autoembed'), 8);
}
add_action('init', 'fyrepress_disable_embeds', 9999);
FyrePress tool: Use the Disable Embeds Snippet generator to create a tailored version.
Optional: Keep Admin Embeds
If your editors rely on embed previews in the block editor, keep admin embeds enabled and only disable front‑end assets.
How to Verify It Worked
- View source and confirm
wp-embed.jsis gone. - Check network requests: no oEmbed discovery calls.
- Paste an embed URL in a post and confirm it no longer auto‑converts (if you disabled it).
Frequently Asked Questions
Will disabling embeds break existing content?
Existing embeds may stop rendering if they rely on oEmbed, but normal links still work.
Should I disable embeds in the admin area?
Only if editors don’t need embed previews. Many sites keep admin embeds enabled.
Does this help performance?
Yes. It removes wp-embed.js and avoids discovery requests.
Is a plugin required?
No. The snippet above is enough for most sites.
Key Takeaways
- Embeds add scripts and discovery calls site‑wide.
- Disable them safely with a short functions.php snippet.
- Keep editor embeds if your workflow needs previews.
Generate the embed‑disable snippet instantly
Use the Disable Embeds Snippet generator to customize the exact snippet you need.