- This topic has 12 replies, 5 voices, and was last updated 3 years, 6 months ago by
Leo.
-
AuthorPosts
-
February 13, 2019 at 4:31 am #809127
Florian
Hello,
I tried many different plugins and PHP snippets to disable the automatic embedding of external content (YT videos, tweets etc.) but none is working.
Is it possible that the theme is the reason for it?February 13, 2019 at 7:11 am #809380David
StaffCustomer SupportHi there,
this article provides a few options:
February 13, 2019 at 7:13 am #809383Florian
Thank you but I’ve tried this and all other plugins I could find. I also tried all PHP code snippets from the first few pages of Google results. I tried everything but I am still able to embed all forms of content (Instagram, Twitter, Youtube).
February 13, 2019 at 8:21 am #809464David
StaffCustomer SupportOdd, this may be a WP 5.0 issue – might be worth reaching out to the author of the Disable Embeds plugin he is a major contributor to WordPress he may be able to advise.
February 13, 2019 at 8:35 am #809489Florian
The plugin you posted is not for disabling embeds of Youtube, Twitter etc, but just to disable embeds of other WP sites, so there is no point in reaching out.
“This basically means nobody can embed your WordPress site and you can’t embed other WordPress sites.
Embeds for Twitter, Facebook, etc. aren’t blocked or anything and they continue to work.”
https://wordpress.org/support/topic/latest-update-has-broken-plugin-2/February 13, 2019 at 8:58 am #809516Tom
Lead DeveloperLead DeveloperAre you adding the links inside Gutenberg? It’s likely that Gutenberg will automatically embed them. What happens if you add the links using a custom HTML block?
February 13, 2019 at 9:01 am #809525Florian
I add the links over the classic editor and over the editor in a forum plugin (which uses the normal backend editor)
I tried different approaches for like 16h now but something must be interfering with it.
February 13, 2019 at 9:03 am #809527Tom
Lead DeveloperLead DeveloperThe theme itself doesn’t do anything when it comes to embeds.
Perhaps this might help?: https://wordpress.stackexchange.com/questions/202496/disable-automatic-oembed-of-a-youtube-url-within-the-content
February 13, 2019 at 9:07 am #809528Florian
No I’ve tried this snippet alone probably 5 times already.
I have to figure out a way now how to check for any interfering code.
February 13, 2019 at 5:48 pm #809824Tom
Lead DeveloperLead DeveloperDid you try the second code on that page?: https://wordpress.stackexchange.com/a/208065
That should handle everything inside WordPress which outputs embeds.
February 13, 2019 at 5:50 pm #809827Florian
Yes, I tried all of them. Anyway, the problem resolved itself indirectly (I don’t need it anymore)
November 16, 2019 at 2:24 am #1064650Shrawan
Hello support,
To disable Embeds can I use the Code Snippets WP plugin?
And which of the codes would you recommend I run?
OPTION 1 —
function disable_embeds_code_init() {
// Remove the REST API endpoint.
remove_action( ‘rest_api_init’, ‘wp_oembed_register_route’ );// Turn off oEmbed auto discovery.
add_filter( ’embed_oembed_discover’, ‘__return_false’ );// Don’t 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 oEmbed-specific JavaScript from the front-end and back-end.
remove_action( ‘wp_head’, ‘wp_oembed_add_host_js’ );
add_filter( ‘tiny_mce_plugins’, ‘disable_embeds_tiny_mce_plugin’ );// Remove all embeds rewrite rules.
add_filter( ‘rewrite_rules_array’, ‘disable_embeds_rewrites’ );// Remove filter of the oEmbed result before any HTTP requests are made.
remove_filter( ‘pre_oembed_result’, ‘wp_filter_pre_oembed_result’, 10 );
}add_action( ‘init’, ‘disable_embeds_code_init’, 9999 );
function disable_embeds_tiny_mce_plugin($plugins) {
return array_diff($plugins, array(‘wpembed’));
}function disable_embeds_rewrites($rules) {
foreach($rules as $rule => $rewrite) {
if(false !== strpos($rewrite, ’embed=true’)) {
unset($rules[$rule]);
}
}
return $rules;
}OPTION 2 —
function wpassist_dequeue_scripts(){
wp_deregister_script(‘wp-embed’);
}
add_action( ‘wp_enqueue_scripts’, ‘wpassist_dequeue_scripts’ );November 16, 2019 at 9:02 am #1064971Leo
StaffCustomer SupportYeah Code Snippets plugin can be used to insert those functions.
You will need to try the codes yourself and see which one works and suits your need.
-
AuthorPosts
- You must be logged in to reply to this topic.