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
- Disable the buildin embed only in the editor
- Can I change Bootstrap button color?
- What is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?
- Customize Bootstrap checkboxes
- Left align and right align within div in Bootstrap
- syntaxError: ‘continue’ not properly in loop
- syntaxError: ‘continue’ not properly in loop
- Vertical Align Center in Bootstrap
- syntaxError: ‘continue’ not properly in loop
- Does bootstrap have builtin padding and margin classes?
- Bootstrap Dropdown menu is not working
- What is sr-only in Bootstrap 3?
- How to set up fixed width for
? - How to change btn color in Bootstrap
- How to remove error about glyphicons-halflings-regular.woff2 not found
- How does the data-toggle attribute work? (What’s its API?)
- How to add hamburger menu in bootstrap
- Adding images to a Bootstrap Carousel with AJAX
- Bootstrap 4 images thumbnail classes
- How to include bootstrap css and js in reactjs app?
- Bootstrap 4 datapicker.js not included
- What does an “&” before a pseudo element in CSS mean?
- Bootstrap NavBar with left, center or right aligned items
- Bootstrap Dropdown menu is not working
- ChangeDate – Date Picker Bootstrap
- Bootstrap Dropdown menu is not working
- How to set up fixed width for
? - Understanding how data-dismiss attribute works in Bootstrap
- How can I center an image in Bootstrap?
- Bootstrap dropdown not working
- bootstrap-datetimepicker for bootstrap 4
- css to make bootstrap navbar transparent
- What is a “meta component” in the context of bootstrap or as a general web design term?
- Bootstrap 4, How do I center-align a button?
- Responsive Bootstrap Jumbotron Background Image
- bootstrap navbar not working correctly
- Changing the width of Bootstrap popover
- Changing the width of Bootstrap popover
- TypeError: $(…).modal is not a function with bootstrap Modal
- Mark error in form using Bootstrap