Per the Codex entry for the_post_thumbnail()
, passing an array has not worked since WordPress 3.0:
PLEASE NOTE: The crop does not work in WP 3.0+. All that is needed for WP 3.0+ is the call for the thumbnail to post. Then proceed to media in the dashboard and set your thumbnail to crop to the size you wish to use.
The correct implementation is to create a custom image size with your array values, via add_image_size()
inside the Theme setup function (or any other callback hooked into after_setup_theme
):
add_image_size( 'custom-size', 1024, 512, true );
…then call that size directly:
the_post_thumbnail( 'custom-size' );
Related Posts:
- the_post_thumbnail responsive srcset not populating with custom image size
- Prevent WordPress from cropping GIF files
- How to crop thumbnail height to auto with set width
- Implementing Zurb’s Interchange Into WordPress
- wordpress responsive image srcset not working
- Use get/the_post_thumbnail with Custom Size & Crop
- Cropped thumbnail still displaying as full image
- Why does the Hard Crop option Scale?
- adaptive featured images wordpress 4.4 grid
- Forcing a user to crop the featured image in a certain aspect ratio
- How to both crop (with tool) and resize thumbnails having only a max width constrain?
- Set Post Thumbnails in Percents
- Server B handling add_image_size() differently than Server A
- Image with large file size not cropping
- Responsive scaling of image for the_post_thumbnail() [closed]
- Add Image Size for Featured Image with Responsive Design
- WordPress image crop probems
- How to select which thumbnails sizes are displayed in srcset
- WordPress 4.4 responsive sometimes doesn’t work
- Define width of featured image thumbnails, but also make responsive?
- Using catch_the_image to get the thumbnail size
- My theme header is stuck on a low resolution image?
- Show a page of non-standard-sized featured images
- Change get_post_thumb responsively?
- Featured Image Thumbnail Sizing
- How to modify responsive images in post thumbnails
- Change featured thumbnail based on screen size
- How do I regenerate thumbnails?
- Add Title Attribute to WordPress Image the_post_thumbnail
- Replacing Gutenberg Featured Image control?
- oEmbed, thumbnails and wordpress
- Cropped featured image replaces original image in gallery
- How to show featured image CAPTION only if it exist
- Add Image Dimensions to Media Library Tab on Media Upoader
- Featured image for news page
- Fallback default image when there is no featured image
- How to get custom image sizes into media uploader dropdown?
- Why are extra 92 pixel square thumbnails created?
- wp-cli regenerate media is not working for custom sizes
- Remove dimensions from filename featured image
- PDF Image in content
- Post Thumbnails multiple sizes
- Long Post Title Misaligning Grid with Featured Image
- How to add multiple featured images to post/page without a plugin
- How do I set “Upload Image” as detault “Set Featured Image” window?
- Featured Image won’t display on Posts page
- Get post thumbnail from subpages with a foreach loop
- Getting images to show up in RSS Reader
- how i can increase Featured thumbnails size?
- the_post_thumbnail() Custom sizes not display correctly
- Set_post_thumbnail not resizing images
- How to inject attributes into get_the_post_thumbnail?
- MultiPostThumbnails for Custom Post Type
- Muliple featured images (or just images) per post
- WordPress Featured Image function recreate
- wp_get_attachment_image_src match smallest edge
- Can’t Set Featured Image [closed]
- Resize post thumbnail produces horrible image quality..Any help?
- media-library: how to insert thumbnails with a fixed width, regardless of landscape/portrait orientation
- Post thumbnail outside of loop
- query_posts adding two “post-entry” divs
- Display a thumbnail outside of the loop for a page
- How to use get_the_title with text on the ‘alt’ of the_thumbnail array?
- remove_image_size doesn’t seem to be working
- Get Featured Image Outside Loop Not Working
- images not showing despite using add_theme_support(‘post-thumbnails’);
- post thumbnail: increase dimension if smaller than… Possible?
- Displaying caption with featured image
- add_theme_support post-thumbnails not working
- Trying to show WordPress category query result as background image
- Serve different images per screen size and cache possible?
- How risize a thumbnail?
- custom thumbnail image size not working
- Comparison Operators not working for conditional author post thumbnails
- Assign SQL ‘post_thumbnail’ column as featured image
- Default thumb – how to set it
- How to update custom image sizes?
- featured images twenty eleven theme
- Picture inserted in the post not showing in “Gallery”
- featured image is not showing
- How to change the format of thumbnails into wordpress theme?
- How to create thumbnails programmatically?
- Usage of add_image_size (for featured image)
- Smaller Size for featured images
- Featured image doesn’t appear in Blog index
- Remove Featured Image based on Date
- How to show only 2nd featured img on home/blog
- Echo recent posts each with its own respective featured image
- How to get post thumbnail to be equal to set media size
- Add notice to add image popup
- Mass/Bulk assign featured images to posts
- setting featured image is not working while running script in background, works when running that script from browser
- get_the_post_thumbnail() – Invalid argument supplied for foreach() in /wp-includes/post-thumbnail-template.php on line 64
- Different thumbnail size than actual picture in post
- How to get the featured image inside of a single-.php template?
- Where is the template from the_post_thumbnail()?
- Get Post Thumbnail Outside of Loop
- Theme:Twenty Fourteen, How to remove featured image on single post page for particular category
- How do I work with responsive images in WordPress? (img srcset/sizes)
- Why not attaching images after impoting using wp cli