Last active
October 20, 2017 13:17
-
-
Save diego-betto/b1829ff4900458a6300a0459d265d3eb to your computer and use it in GitHub Desktop.
Disable default Wordpress embeds in frontend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// in functions.php | |
if (!is_admin()){ | |
remove_action( 'rest_api_init', 'wp_oembed_register_route' ); | |
add_filter( 'embed_oembed_discover', '__return_false' ); | |
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 ); | |
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); | |
remove_action( 'wp_head', 'wp_oembed_add_host_js' ); | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment