How to Disable the WordPress 4.4 Post Embed Feature

WordPress includes a post embed feature that allows other sites to show your content simply by pasting one of your post URLs. Compared with a normal text link, that is a more advanced and user-friendly feature. But not every site actually needs it.

If you want to disable post embed support in WordPress 4.4, add the following code to the theme’s functions.php file:

// Remove the REST API endpoint
remove_action( 'rest_api_init', 'wp_oembed_register_route' );

// Disable automatic oEmbed discovery
add_filter( 'embed_oembed_discover', '__return_false' );

// Do not filter oEmbed results
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );

// Remove oEmbed discovery links
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );

// Remove the JavaScript used for oEmbed
remove_action( 'wp_head', 'wp_oembed_add_host_js' );

That is enough to turn off the WordPress 4.4 post embed feature.

If you prefer to solve the problem with a plugin instead of code, there is also a plugin called Disable Embeds that does the same thing after installation and activation.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *