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 | |
/** | |
* Plugin Name: Disable Embeds posts for me | |
* Description: Don't want to fetch external emebed posts? | |
* Version: 1.0 | |
* Author: Julio Potier | |
* Author URI: https://wp-rocket.me | |
* License: GPLv2+ | |
* | |
*/ | |
add_filter( 'embed_oembed_html', 'hack_embed_oembed_html', 10, 2 ); | |
function hack_embed_oembed_html( $html, $url ) { | |
if ( ! class_exists( 'WP_oEmbed' ) ) { | |
include( ABSPATH . WPINC . '/class-oembed.php' ); | |
} | |
$WP_oEmbed = new WP_oEmbed(); | |
if ( ! $WP_oEmbed->get_provider( $url, array( 'discover' => false ) ) ) { | |
return ''; | |
} | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment