Use the oembed_dataparse filter to modify the resulting HTML output by any given oembed call.
Example:
add_filter('oembed_dataparse','test',10,3);
function test($return, $data, $url) {
if ($data->provider_name == 'YouTube') {
return "<img src="https://wordpress.stackexchange.com/questions/79894/{$data->thumbnail_url}">";
}
else return $return;
}
Then putting this in a post:
Will give you a picture of Rick Astley instead of a flash video of him. 🙂
Edit: Note that WordPress caches oEmbed results in postmeta. So after making your code, you’ll have to go and Update a post for it to know to go re-get the oEmbed data and have code like this take effect. In case you want to do testing and such.
Related Posts:
- Featured Image of Video from oembed
- oEmbed, thumbnails and wordpress
- How do you remove hard coded thumbnail image dimensions?
- How do you get the post thumbnail size?
- Setting a post’s featured image from an embedded YouTube video
- Minimum Dimensions Requirement for Featured Image?
- Display thumbnail only if requested size exists
- the_post_thumbnail hard cropping not working no matter what
- the_post_thumbnail with lazyload JQ plugin
- Display Post Thumbnail Without Being Featured Image
- Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
- Set post-thumbnail (with php)?
- get_thumbnail_id returns full size image
- can the_excerpt function also get images?
- Change Output for Images in Content
- Add post title as alt tag for featured image
- How to scale up image into thumbnail without distorting it?
- Using Gutenberg block components in admin interface controls
- previous / next post with thumbnail
- Multiple Post Thumbnails plugin and attachment error
- WordPress resizes image to the same size as uploaded
- Possible to swap in a placeholder image globally for the_post_thumbnail_url if one doesn’t exist?
- How to set an attachments parent post id in code?
- How to use wp_get_attachment_metadata for thumbnails
- Wrap post thumbnail with
- Use wp_remote_get to add image to media library
- Can a thumbnail of an animated gif be animated?
- Is it possible to get local image URL when also having photon active?
- Featured Image Size Conditional Tag?
- How can I call a thumbnail/featured image to be a background image?
- create new post using rest API and set featured Image from an external link
- Replicate featured image functionality
- Woocommerce – remove the default image placeholder? [closed]
- Remove link from post images
- Call Featured Image from Parent Page
- How to add post featured image url to inline background url()?
- Allow author to choose his featured image size
- How to get cropped thumbnail source for custom post type
- Using thumbnail functions inside a shortcode
- Featured image for first post only
- Featured Image Not Working when loaded from sub-domain
- How can I use a static (ish) URL for the featured image for a post?
- How To Add and Display Category Image
- specify size of post preview image (not post thumbnail)
- featured image inside post
- get_post_thumbnail_id /set_post_thumbnail not working
- Featured image/thumbnail fallback placeholder image
- Add class to custom thumbnail
- How can i hide post without thumbnails/featured images from index pages?
- How to add gallery support in WordPress?
- get_the_post_thumbnail wordpress 3.5
- How do WP know an image is a post thumbnail
- Featured Image Link to next post?
- How to get a page’s featured image from a term slug (same name)
- Thumbnail is showing outside its div instead of inside it
- How do I get only the image URL from the_post_thumbnail()?
- Add extra fields to the post’s featured image
- WordPress showing image as thumbnail without using thumbnail
- Get post thumbnail to display favorites
- Unrestricted height thumbnails
- WordPress generated thumbnails
- How can I assign bloginfo path or thumbnail path to a variable and call it in markup?
- how to resize thumbnail image
- Use the_post_thumbnail as background image in LESS CSS [closed]
- Featured image for social sharing ot author archive page
- How can I specify the width and height of the Featured Image in TwentyTwelve theme?
- Can’t change image size from post “Show current page featured image in sidebar”
- How to implement two separate featured images for each post/page
- Using catch_the_image to get the thumbnail size
- Moved server, and WP now uses original images for all thumb sizes?
- WordPress stopped generating image thumbnails after changing hosting environment
- Thumbnail size problem Desktop vs Mobile site
- Cropped featured image
- My theme header is stuck on a low resolution image?
- Thumbnail (featured image) and Media Library cleanup queries help needed
- Child Theme not overwriting Parent theme php file
- Image size doesnt change via wp_get_attachment_image_src
- replace featured image from frontend
- Thumbnails are hard cropped not matter what
- Post thumbnail not working when previewing post
- Post thumbnail not displaying correct size
- How to add post thumbnail on posts on sites homepage?
- Conditional: IF current author’s custom post has a post thumbnail
- How to undo thumbnail regenration
- IF statement to filter featured image article
- Featured image url
- How to add a class to figure tag for featured images?
- Post thumbnail won’t resize to fit
- Trouble Retrieving Thumbnail URL on Front-Page
- Featured Image not showing on wordpress hosted under Amazon AWS
- Featured Image / Post Thumbnail Cropping Query
- Using set_post_thumbnail inside save_post action gets overwritten
- trouble with the_post_thumbnail
- How can I make thumbnails a display different size/position if the blog post was posted before a specific date?
- Change background image in PHP
- Display featured image metadata?
- get_post_thumbnail_id() not getting correct featured image after post edited
- How to I remove Featured Image from the Posts/Category Lists?
- How do I change the size of the feature picture of a single post?
- Close featured image modal windows with JS