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
- How do I get a YouTube video thumbnail from the YouTube API?
- Youtube_dl : ERROR : YouTube said: Unable to extract video data
- oEmbed, thumbnails and wordpress
- Correct regex for wp_embed_register_handler
- Detecting Embed URLs Within post_content
- How can i create a function to get youtube video time
- How to remove the embed_footer?
- Filter oembeds tags to modify iframe attributes
- oEmbed vimeo with add_query_arg parameters not inserted to HTML
- How do I display Youtube/Vimeo video ID on custom post type when user enters it in custom meta box?
- wp_embed_register_handler to embed html files
- Use Auto Embed with get_post()
- Video shortcode – autoplay all videos
- How to center oEmbedded content
- Is there a built in function to see if a URLis oEmbed Compatible?
- How to import my YouTube channel into WordPress?
- pass user id in slug and get user information
- Does the default WordPress video player support closed captions?
- YouTube Video autoplay
- How to set up front end editor to autoembed media for non-logged in users?
- How to register a embed handler as a fallback to a oEmbed handler?
- How To Replace WordPress Native Player With Fluid Player? [closed]
- JSON in oembed not being internationalized (using QTranslateX)
- Responsive Embeds using default embed shortcode
- Feed error: A feed could not be found at youtube.com/… (1 post) [closed]
- Preferred WordPress video format?
- WordPress get_media_embedded
- Modify YouTube Embed Code to fit theme
- How to edit embed filter for youtube video to allow responsive full width layout
- Play videos with buffering in my server
- I’m having a problem viewing the Youtube video
- Adding a cover image to video shortcode
- WordPress fails to embed video URL
- Rename Smart YouTube’s httpv back to http for all posts
- Hide download option video shortcode
- Can’t embed certain youtube videos into theme
- Block editor: Sandbox iframe shows outdated HTML
- Get youtube link title in post title
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- How to load post_meta for custom post type via Ajax
- Page will only display first 6 videos
- Can’t play FLV in WordPress website [closed]
- stop all video players when starting an other to play?
- Conditionally enable autoplay when using oEmbed in a custom widget
- Practical Solutions to HTML5 Video on WordPress
- plugin to upload to youtube via wordpress [closed]