diff --git a/functions.php b/functions.php index 444bb1d..68dae55 100644 --- a/functions.php +++ b/functions.php @@ -1,30 +1,35 @@ @@ -37,3 +42,14 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= EOF; } + +// disable oembed if url is not my site url +add_filter('oembed_request_post_id', 'niu_check_oembed_url', 10, 2); +function niu_check_oembed_url($post_id, $url) +{ + if (!preg_match('/^'.preg_quote(get_site_url(), '/').'/', $url)) { + return 0; + } + + return $post_id; +}