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
- ChangeDate – Date Picker Bootstrap
- How can I center an image in Bootstrap?
- Table fixed header and scrollable body
- Set textarea width to 100% in bootstrap modal
- How to open a Bootstrap modal window using jQuery?
- How to en-queue bootstrap 4 to theme?
- HTML Bootstrap navigation menu to WordPress menu using wp_nav_menu
- Combining RSS Feeds and Sorting with fetch_feed
- How can I add @anywhere to my blog?
- Adding a video description in a similar way to a image caption
- Best Practices for Video Uploads to WordPress
- What Plugin Do You Use to Turn WordPress based site to A Blog Aggregator
- Adding class to featured image
- Custom Theme Bootstrap
- How to set the cache for the built-in SimplePie feed parser?
- WordPress appends RSS item with unwanted content
- How to make a video play for homepage?
- w3c validation problem – Twitter share button pulling content
- Is there a Twitter WordPress plugin that changes https to http?
- Custom query AFTER rss fetch_feed not working
- WordPress + Bootstrap [closed]
- body_class(); not working with bootstrap navbar fixed top?
- Set custom id to list element walker custom function
- Change class names dynamically added to html elements by wordpress
- Generating a feed of all but one category of posts
- How to preserve HTML from posts in RSS feed
- Hide download option video shortcode
- bootstrap carousel in wordpress home page showing small images and not responsive
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- How to modify the HTML output of Gutenberg block? (Youtube)
- WordPress 5.2.1: Embed video is not working. Showing video link on fronted
- Videos Post Type with Custom Filters
- How to create a mobile menu full screen overlay using Understraps Bootstrap 4 theme
- Render Shortcode in Lightbox Gallery
- Different custom header video on different pages
- Adding a second RSS feed
- Page will only display first 6 videos
- Conditionally enable autoplay when using oEmbed in a custom widget
- Strip Twitter Username from Profile Field with URL and Save to New Profile Field
- WordPress Loop with Custom Post Type for Bootstrap Accordion [closed]