You can try this:
add_filter( 'embed_oembed_html', 'custom_youtube_oembed' );
function custom_youtube_oembed( $code ){
if( stripos( $code, 'youtube.com' ) !== FALSE && stripos( $code, 'iframe' ) !== FALSE )
$code = str_replace( '<iframe', '<iframe class="youtube-player" type="text/html" ', $code );
return $code;
}
to target the YouTube oembed HTML output.
When I embed this YouTube link (Kraftwerk) into the post content
http://youtu.be/VXa9tXcMhXQ
I get this HTML output:
<iframe class="youtube-player" type="text/html"
width="625" height="469"
src="http://www.youtube.com/embed/VXa9tXcMhXQ?feature=oembed"
frameborder="0" allowfullscreen></iframe>
with the above filter.
Related Posts:
- YouTube oEmbed and privacy-enhanced mode
- oEmbed youtube video aspect ratio
- Adding a wrapper to the youtube embed automatically?
- WordPress, oEmbed & YouTube video’s with a ‘dash’
- oEmbed not working in WordPress
- Echo do shortcode with custom field not working
- YouTube: How to extract closed caption transcript from YouTube video?
- Is there a way to get all IP addresses of youtube to block it with Windows Firewall?
- YouTube maxresdefault thumbnails
- Youtube – downloading a playlist – youtube-dl
- URL syntax for Youtube video in fullscreen and start at time index
- How to customize an end time for a YouTube video?
- How can I clear oEmbed caches for YouTube on posts as they are loaded
- How to Replace YouTube Videos with a “Click to Play” Thumbnail?
- Modify youtube video size on one page and show another size on different page
- Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
- Manipulating oembed_dataparse stopped working for YouTube embeds
- Get all Youtube video’s from posts and embed them on a different page
- WordPress 5.3.x YouTube oEmbed is not working
- Use oEmbed in List Items
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- Video Embed with Captions in Turkish
- Link Youtube Channel In WordPress Site
- Embed youtube list with sidemenu opened
- Getting youtube links from post_content not working
- How can I grab the video id of youtube?
- Add latest Youtube videos on main page [closed]
- How to apply an ID to Shortcode Embedded iframe
- How can I remove the first video from a post and feature it?
- Viddler oEmbed not working with specified width
- How to embed YouTube videos in posts without adding suggested videos at the end?
- How do I embed a YouTube video in WordPress 3.0?
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- Div around YouTube video
- YouTube API 403 error when website restriction set
- Add parameter to first post only
- Get YouTube video id from url in a custom field
- Looking to Customize YouTube Video Embeds
- Static image for embedded YouTube video instead of blank player?
- How to change src link in YouTube?
- How to make an image of a YouTube video appear as a thumbnail in the list of blog posts
- Is there a way to find all posts with Youtube video embedded?
- WordPress fails to embed video URL on specific theme
- How to add srcdoc attribute to YouTube oEmbed in Gutenberg oEmbed Block
- How to modify the HTML output of Gutenberg block? (Youtube)
- WordPress and Youtube problem
- Advanced Custom Fields oEmbed video width and height
- Iframe Youtube video doesn’t work
- WordPress Mediaelement – Youtube Videos Embed Options
- display only youtube video sticky post
- Displaying cf post formats with oembed
- Generate a WP post from Youtube Feed
- Importing YouTube Videos As Posts – From Playlists
- Avoid embedding YouTube videos and open them in a new window
- add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed
- Embbeded YouTube video not showing when admin logged in
- How to embed a youtube playlist with a sidebar
- Use [embed] filter in template files
- static variable loop not working in WordPress
- How to make native video player full width?
- How do i disable or Remove the Native WordPress Video Player?
- Implementing “Video of the Day” Feature?
- how to escape wp_oembed_get for phpcs
- Extract the first oembed url inserted on the content of a post
- Add wrapper to only youtube videos via embed_oembed_html filter function
- How to add new embed handler not supported by oembed
- Making oEmbed work on the excerpt field
- How to Hide Ancestors/Threads in Embedded Tweets
- vimeo/youtube video embed with thumbnails
- Embed YouTube video from custom field value
- Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?
- possibility to control embedded video timeline with buttons and links external to the player
- WordPress site in China times out on requests to youtube [closed]
- Responsive embed for the video shortcode
- image in new embedded player
- Adding Videos as post-thumbnails (no stills, just the player in a smaller size)
- Why is my oembed function modifying Twitter embed?
- Capture mediaelement events
- Set featured image for video thumbnail automaticlly
- oembed_cache SPAM problem [closed]
- videos not showing on my tag pages
- Combine embed_oembed_html and oembed_result
- oEmbed Video in Modal
- how to show youtube comment profile pic in wordpress
- Embedding local video in WordPress comments
- youtube full screen on off permater code help for wordpress
- how to make video autoplay in widget
- Auto Resize embedded videos player
- Remove wordpress embed share icon?
- Video Short Code and Media Fragments URI
- Load oEmbed iframe within ajax call
- How to set parameters for a Twitter post using wp_oembed_get (remove rounded borders)?
- Youtube Iframe Api play one video at a time
- After import, oEmbeds non-functional until manual republish
- Video Player for Free WordPress Site [closed]
- Completely disable oEmbed and auto-embed on frontend and post editor?
- Why, on Attachment pages, where the media is a video, is the video is appearing twice as Widgets in the sidebar?
- How to cache WordPress oembed links in the page header?
- Not allowing my site to be embedded elsewhere via oEmbed
- Embeds (YouTube, Spotify) Work Live but Won’t Load in Block Editor [closed]