How To Remove wp-embed For AMP In WordPress

Removing wp-embed in WordPress can help pass the AMP validation test for your website to become AMP ready. All you may need is to deregister the wp-embed script.

Remove wp-embed from WordPress

You can remove this by adding the below function to your WordPress theme’s functions.php file.

  1. Open functions.php by navigating to Appearance > Editor > Theme Functions in WordPress;
  2. Add the function below function and WordPress action.
function deregister_wp_scripts() {
 wp_deregister_script( 'wp-embed' );

add_action( 'wp_footer', 'deregister_wp_scripts' );