Skip to main content
Login Join
Snippet · PHP

Disable WordPress Embeds

Shared by Amit Dholiya · May 23, 2026

2 copies
53 views
1 upvote
Back to Snippets

WordPress loads an embed script (wp-embed.min.js) on every page to support embedding WordPress content on other sites. If you don’t use this feature, you can disable it to reduce page weight.

Steps

  1. Open your WordPress theme functions.php file.
  2. Add the code below at the end of the file.
  3. Save the file.
  4. Clear your cache and refresh your site.

Done — WordPress will stop loading the embed scrip

Note: If you embed WordPress posts on external websites or rely on embedding features, do not use this snippet.

function disable_wp_embeds() {
    wp_deregister_script('wp-embed');
}
add_action('wp_footer', 'disable_wp_embeds');
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments