Where are you attempting to get the image? That should be the correct function:
global $post;
$image = get_the_post_thumbnail( $post->ID );
It will return an array of all the image sizes for that given image. You can then grab the image size out of the array, or better yet pass in a specific image size to the function to return the correct size:
global $post;
$image = get_the_post_thumbnail( $post->ID , 'thubmnail' );
as you can see we’ve passed in the ‘thumbnail’ image size. $image will then return the url to the image size. You can then use it in an image tag, like so:
<img src="https://wordpress.stackexchange.com/questions/166150/<?php echo esc_attr( esc_url( $image ) ); ?>" alt="thumbnail image">
Related Posts:
- show hide image script after 4 seconds [closed]
- How do I disable responsive images in WP 4.4?
- Set default image sizes in WordPress to hard crop
- After Moving a Site to Another Domain, All Images Are Lost
- How to find attachment by it’s name?
- Change html structure of all img tags in WordPress
- How to disable “insert into post” only when selecting the Featured Image?
- Is there a way to define a default caption to all uploaded images
- How can I add the “Use as featured image” to a custom metabox?
- How to increase media image scale limit?
- Dynamic-Image-Resize Plugin does not output anything
- Cannot access the thumbnails of attachment images… Cannot find the reason
- How to place an image into header.php? [closed]
- Uploading an image as featured image from frontend form
- Add a featured image in my theme?
- @wordpress/create-block image url in css
- How does WordPress work out the srcsets?
- How to include a picture in a blog post such that it will show in Facebook?
- Remove ‘wp-content/themes/themename/’ from Image path
- help getting featured image using get_posts
- Why html tags are being appended to my pictures?
- Why can I not view image attachment pages?
- Restrict Image Uploads to a Certain File Type
- wordpress media library shows empty images
- How to change the target size of images clicked on in WordPress standard gallery
- Image popup in a lightbox / overlay from the backend 3.5 admin area (plugin)
- media sideload image and Google Content
- Mobile Featured Image Bug
- How to display alt tags in img src?
- Big Image on Featured Post, Normal on Single Post
- Making images in posts link to the image file rather than the attachment page
- offload media to external services [closed]
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- Imagick vs GD colour issues on image uploads
- How to add image and featured image to post by WP REST API
- Jetpack’s photon causes local site to try and serve images from WordPress CDN [closed]
- How to stop wordpress always displaying full-res images
- Transfer only original images to new site
- WordPress PNG compression issue
- Fallback image size when using wp_get_attachment_image_src / full size compressed image
- Rewrite all article pictures to link to file
- Upload box media size not working
- Featured images disappear after DB export/import?
- I want to Add My Product Image to Admin Order Email in Woocommerece [closed]
- Resize images in batch
- how to get image full path from WP_Post Object?
- Featured Image problem with resizing
- How would you add sequentially numbered labels to images in posts?
- Advice on image heavy site, compression and slow page loads
- Not seeing text alignment option in Image block
- wp_get_attachment_url images in wrong order [closed]
- Blurry images when using add_image_size with crop
- Auto delete pictures in media library by age
- Migrated site – Images have 404 error
- Show (print) featured image all dimensions (height, width)
- Speed Up Website With High Resolution Images
- Can wp_get_image_editor convert to icon?
- How to get image URL from media_sideload_image?
- Can’t get text to wrap around image
- Allow SVG in WP step by step
- Serve different images per screen size and cache possible?
- Auto-crop width, not height
- Convert featured images into “product images”
- How come the images arent loading properly?
- How to use the thumbnail size with catch_that_image
- Not able to retrieve image id from sibling site within a switch_to_blog
- How to display a warning when an uploaded image is too small?
- Large uploaded images not resizing?
- Having an issue in compressing Images in wordpress site
- How to generate alt attributes with php / filters?
- Word press cutting sliding images – not displaying the entire image
- Image links broken / “DNS Update Required” message
- Convert multiple image blocks to gallery block in Gutenberg?
- WordPress After migration some images src is empty
- Image sizes reset when changing theme
- How to get featured image of last post in a category?
- How can I add “alt” tag to element?
- After moving a site to new hosting, not all images are showing in media library
- Recovered WordPress installation (on localhost) links broken and images not showing
- Custom Background for each page and post
- How can the alt be added to this wooCommerce category image?
- Media sizes do not appear
- How to make Facebook share the featuterd image from url on WordPress
- Changing current post image uls with a function
- Delete images of a particular size
- How to watermark wordpress images from wp-content/uploads folder with htaccess and php?
- How to display every pictures from all the posts on one page?
- How to add multiple images in a page
- Images not rendering
- Retrieving Image Storage path
- Add category description to list of category with taxonomy image
- how to display all images from their siblings/ from same parent?
- How do I get the URL of only the first picture in a WordPress post?
- Specify what to do for a specific image number of the post
- How do you change all images dimensions to have the same size?
- Images getting corrupt automatically
- Thumbnail size keeps resetting automatically
- I am having trouble displaying an image at the top of a widget area [closed]
- Can’t upload svg files in WordPress
- Images uploaded in customized gallery do not link to media