WordPress From version 3.5, some options will be removed from the UI:
- One of the options isEmbeds settings.
autoembed_urls
, toggle the checkbox, continue, and always assume oEmbed is on.The only reason to turn the UI on/off for oEmbed is if it's easy to accidentally embed items.But it doesn't parse every link in the post, just its own link or the link in the [embedded] code.
This is the oEmbed settings interface in WordPress 3.4▼
- As of WordPress version 3.5, there is no visible setting that allows you to disable auto-embedding.
WordPress is WordPress, and if it doesn't, there's another way to disable it.
Embedding is handled by the WP_Embed class:
- The constructor of the class registers some actions and filters, and a filter
the_content
▼
add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
Turn off the oEmbed feature
Now we just need to remove the specific filter again ▼
- Since we can't
$this
Onremove_filter
used in the call, we need to use$wp_embed
A global variable that contains object references.
In the functions.php file of your WordPress theme, add the following code ▼
//禁用WordPress的自动嵌入> = v3.5
remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "How to Disable Auto-Embedding in WordPress?Turn off the oEmbed method" to help you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-1814.html
Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!