You should be doing some sort of check at the beginning of your function to ensure you’re in an oembed that you actually want to mod. something like
if (strpos($url, youtube.com) === false && strpos($url, vimeo.com) === false) {
return $cache;
}
Although you might want to elaborate on that to catch shortened urls like youtu.be as well.
Related Posts:
- How to Hide Ancestors/Threads in Embedded Tweets
- How to set parameters for a Twitter post using wp_oembed_get (remove rounded borders)?
- When oEmbed fails, display an alternative
- Get first video from the post (both embed and video shortcodes)
- How to change default width parameter of embedded video in wordpress?
- Is it possible to remove height and width attributes from oEmbed video embeds
- how to escape wp_oembed_get for phpcs
- Fallback for oEmbed content
- Changing Oembed max width based type of page
- WordPress refuses to show oembed URL
- Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
- Problems using WP’s oembed function + Instagram + AJAX
- How to add new embed handler not supported by oembed
- How to increase image size returned from Flickr oEmbed in Twenty Twelve theme
- How to get the oEmbed type (audio, video, image etc.)?
- Disable automatic oEmbed of a youtube url within the content
- Add parameters vimeo videos using wordpress embeds
- Twitter feed is showing blank in WP site [closed]
- oEmbed vimeo with add_query_arg parameters not inserted to HTML
- oEmbed fails half of the times. Could I reload the request on fail?
- WordPress 5.3.x YouTube oEmbed is not working
- Getting results from wp_oembed_add_provider
- add oembed provider
- Register Embed Handler for Padlet.com
- wp_insert_post iframe missing
- How to check If Oembed is empty or not
- Use Auto Embed with get_post()
- How to modify the HTML formatting of an oEmbed link?
- OEMBED seems to have stopped working
- oEmbed not recognising Vimeo URLs
- Is there a built in function to see if a URLis oEmbed Compatible?
- Video Embed with Captions in Turkish
- Applying an oEmbed filter to a custom post type
- Twitter links in widget don’t work?
- How to oEmbed MySite in WordPress
- Worrisome oembed hits
- What is the correct oembed provider base url for self-hosted wordpress sites
- oEmbed not working in WordPress
- Problem with oEmbed in some themes
- JSON in oembed not being internationalized (using QTranslateX)
- How can I remove the first video from a post and feature it?
- Viddler oEmbed not working with specified width
- WordPress kills an iframe’s apostrophes
- How can I replace an oEmbed URL in post with actual embed HTML
- Add title attribute to oEmbed iframe for accessibility
- What are available arguments for wp_oembed_get?
- Looking to Customize YouTube Video Embeds
- Add class to oEmbed video from within post editor?
- Pull Youtube Link from 2nd WP_Editor
- Different size video display for category page (smaller) & detail page (larger)
- Embed video from streamtape using direct link
- How to disable oembed cache service?
- How do I keep my iframes responsive and scaled to fit their container?
- Use oEmbed for static html
- class-oembed Error
- Wrap iframes/embeds, but do it before oEmbed happens
- Turn twitter-urls into list timelines?
- do_shortcode for twitter doesn’t work well
- When formatting an oEmbed iframe, how (and where) does WordPress determine the height value?
- Avoid embedding YouTube videos and open them in a new window
- syntaxError: ‘continue’ not properly in loop
- Bootstrap transparent navbar
- Bootstrap change carousel height
- Get all posts in RSS
- How can I generate a RSS feed based on a custom WP_Query?
- Refresh external feeds only in cron?
- WordPress oEmbed W3C Validation
- Adding a wrapper to the youtube embed automatically?
- Getting a thumbnail for an external video as the thumbnail for a custom post type?
- Best practices for multiple Custom Feeds functions
- how improve website mainpage loading
- Add ![CDATA] to permalink rss
- Main Menu and Sub Menu Items for Footer
- How to add class to and childs of sidebar widget – WordPress
- custom rss templete
- Updating the Drag-To-Share eXtended share URLs?
- Styling text and images in the_content()
- force feed readers to pick atom version
- How to embed .mp4 videos in a WordPress post?
- Let users sell video in my website [closed]
- My website is not showing Footer section
- Change conditionally a variable value for different feeds
- How to style bootstrap container in wordpress theme?
- Twitter feed – Failed to open stream [closed]
- Get video from the post on homepage
- Facebook and Twitter share buttons not working [closed]
- Auto embeds don’t work for attachment descriptions
- Make bootstrap 5.0 carousel dynamic using ACF and CPT UI [closed]
- WordPress does not load jQuery
- Optimal method for organizing videos by topics discussed?
- How to disable URL preview in WordPress comments
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- Remove Default Read More Link in Manual Excerpt RSS Feed
- From php web to wordpress conversion, href changes only in URL
- Get link for feed of specific post type AND taxonomy
- Twitter List Tweets and Delicious Links as Posts
- Publishing tweets from wordpress [closed]
- Publish post facebook page & twitter automatically [closed]
- Best Practice Jumbotron Image for WordPress ~ Responsive
- add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed