“Disable oEmbed” can mean four different WordPress changes: stop WordPress discovering embeds from external URLs, stop other sites discovering your posts, prevent the host JavaScript, or remove one provider such as YouTube. Use the narrowest option below, then inspect a freshly rendered page and your installed WordPress version to confirm the result.
First, identify what you want to disable
| Goal | Control | What it changes |
|---|---|---|
| Stop WordPress discovering provider endpoints for pasted URLs | embed_oembed_discover |
Stops incoming discovery of oEmbed link tags; it does not remove your site’s own discovery links or the host script. |
| Stop other sites discovering your posts | wp_oembed_add_discovery_links |
Removes outgoing oEmbed alternate links from eligible singular pages. |
| Prevent the WordPress oEmbed host script | wp_oembed_add_host_js |
Uses WordPress’s compatibility removal pattern; it does not disable every oEmbed feature. |
| Disable one service only | wp_oembed_remove_provider() |
Removes a selected oEmbed-enabled provider while leaving other providers available. |
WordPress describes oEmbed as a protocol that lets a consumer request embed HTML from a provider such as YouTube. It handles media including video, images and text, and maintains an internal provider whitelist. See the WordPress oEmbed handbook.
Stop WordPress discovering embeds from external URLs
Use this when you want pasted provider URLs to stop being inspected for discoverable endpoint links. The documented default for embed_oembed_discover is true.
add_filter( 'embed_oembed_discover', '__return_false' );
The embed_oembed_discover reference defines this filter as controlling whether WordPress inspects a URL for discoverable link tags. This is narrower than disabling all embed output: already supported providers and other embed paths may still behave differently.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
Remove oEmbed discovery links from your WordPress header
WordPress adds discovery links to the head of eligible singular posts so another site can request an oEmbed representation of that post. Remove that callback if your goal is to stop advertising those endpoints.
add_action( 'init', function () {
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
} );
The wp_oembed_add_discovery_links() reference records priority 4 in WordPress 6.9.0, with a fallback at priority 10. Because callback timing can vary by installed core version, view the rendered page source after applying the change. Confirm that the application/json+oembed alternate link—and any XML alternate link emitted by that installation—is absent.
You can also use the documented oembed_discovery_links filter when you need to adjust the emitted HTML rather than remove the callback entirely.
Prevent the oEmbed host JavaScript
If the specific target is WordPress’s host script (commonly seen as wp-embed.min.js), use the compatibility removal pattern:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
WordPress documents wp_oembed_add_host_js() as deprecated since WordPress 5.9.0. The action remains as a compatibility signal checked by wp_maybe_enqueue_oembed_host_js(), so this snippet addresses the host-script behavior only; it does not turn off provider discovery, outgoing discovery links or every oEmbed capability. Verify the final HTML and script list on the WordPress release you run. See the wp_oembed_add_host_js() reference.
Disable one provider while keeping other embeds
For a service-specific requirement, remove that provider instead of changing global discovery or script behavior:
Rank #4
wp_oembed_remove_provider( $format );
Use the provider’s registered format pattern for $format; check the provider registration on your site and test with a representative URL. The official handbook documents wp_oembed_remove_provider() as the removal mechanism for an oEmbed-enabled provider. This is the appropriate scope for “disable YouTube but keep Vimeo,” for example, but the exact pattern must match the provider registration in your WordPress configuration. Do not describe it as disabling all oEmbed.
Where to put the code safely
- Prefer a small site-specific plugin so the customization survives theme changes.
- A child theme’s
functions.phpis another suitable location; avoid editing a parent theme that will be updated. - Make one change at a time and test a singular post, an external provider URL and the page source as appropriate to your goal.
The snippets above are WordPress hook examples, not a guarantee that a particular theme, optimization layer or plugin will register callbacks identically.
Best Value
Verify the result and troubleshoot
Check the rendered source
Open a fresh page, view its source and search for application/json+oembed, alternate, wp-embed and the provider URL. Discovery-link removal should affect the alternate links; host-script removal should affect the script reference.
Clear caches before judging
If a caching or optimization plugin serves old HTML, purge its cache and any page or CDN cache, then test in a private browser window. This is a practical verification step, not a WordPress guarantee.
Remember the security boundary
WordPress’s discovery support dates to version 4.4. For non-whitelisted sites, discovered HTML and video are filtered to restricted elements and sandboxed; enabling discovery is limited to users with the unfiltered_html capability. Preserve those filtering and sandbox controls rather than bypassing them casually. The handbook explains the behavior at developer.wordpress.org/advanced-administration/wordpress/oembed/.
Version notes that affect the snippets
- The WordPress oEmbed handbook was updated July 7, 2025.
- The
embed_oembed_discoverdefault is documented as true, with that default changed in WordPress 4.4.0. wp_oembed_add_host_js()is documented as deprecated since WordPress 5.9.0.- WordPress 6.9.0 documentation records the discovery-links callback at priority 4, with a priority-10 fallback.
Because hook registration and third-party plugins can differ, always confirm the behavior on the version and configuration your site actually uses.
Recommended Free Tools
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

