You are misreading the Codex. wp_get_attachment_image_src()
works just fine with custom image sizes.
Proof of concept:
// copied from the Codex
// https://codex.wordpress.org/Function_Reference/add_image_size
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height)
add_image_size( 'homepage-thumb', 220, 180, true ); //(cropped)
}
Add an image to the Library, then…
$image_attributes = wp_get_attachment_image_src( 28, 'category-thumb' );
var_dump($image_attributes);
You will notice that the image returned is (an appromixation of) 300×9999– that is 300 wide by whatever height scales correctly.
Related Posts:
- How to disable WordPress from creating thumbnails?
- How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)
- Display Category Thumbnail and links in Woo commerce
- Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
- Featured image size in ADMIN panel?
- Featured image with the same height thumbs returns wrong thumb
- 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]
- Need clear explanation about medias/files/attchments
- 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?
- get_the_post_thumbnail ignores my default thumbnail size [closed]
- Remove the link to a featured image if and only if it’s not a gif
- How to query posts with featured images
- hrecipe microformat tag to “featured image”
- Server B handling add_image_size() differently than Server A
- the_title() is not displaying over the_thumbnail
- Show posts image attachments
- Choose to Display Post Thumbnail?
- How do I make images appear in the beside blog post summaries?
- Featured Image meta box shows at the bottom?
- Thumbnail is showing outside its div instead of inside it
- How can I assign bloginfo path or thumbnail path to a variable and call it in markup?
- Use the_post_thumbnail as background image in LESS CSS [closed]
- How to get featured image thumbnail to open larger version in attachment page?
- How To Use YouTube Url Stored In Custom Field To Get Video Image and Set it As Featured Image
- Display post thumbnail in foreach loop
- Add image size array to a portfolio thumbnail in combination with Masonry Jquery Plugin
- Define width of featured image thumbnails, but also make responsive?
- Add title to image post
- How to attach images that I “insert from url” into the post?
- If no featured image, add one of the default images into DB
- the_post_thumbnail(‘medium’) still gives thumbnail-size img
- My Gallery Photos are showing in the post’s excerpts
- the_post_thumbnail not resizing
- How to add featured images to posts from a category
- WordPress stopped generating image thumbnails after changing hosting environment
- How do you code a featured image into an XML as a jpg link, instead of using a data-id number?
- My theme header is stuck on a low resolution image?
- Change featured image when changing viewport
- Adding guiding text to the ‘Featured Image’-box in the backend
- Thumbnails are hard cropped not matter what
- Thumbnails regenerate wp_generate_attachment_metadata
- Using the_post_thumbnail do not rollback to original image if specified thumbnail does not exist
- Get author image from corresponding article in thumbnail
- Missing image size
- water mark on featured post image in wordpress
- Making a ‘featured image’ become the image for a full banner (top of page) image in a blog post?
- How to change text of Remove featured image
- Add space under featured image in singel post
- How to undo thumbnail regenration
- Genereate widescreen featured images in different sizes
- set_post_thumbnail() shows Unattached on backend under Media
- How to get the URL of a each custom image size of a featured image
- Recent posts show thumbnail
- Add Featured Image from Existing wp-content folder
- Featured Images missing on migrated site
- Trouble Retrieving Thumbnail URL on Front-Page
- Pointing Existing featured images to s3 bucket
- Displaying All Parent Pages as Featured Images
- Featured Images not appearing
- Editing featured image
- WordPress save thumbnail but don’t show it [closed]
- Get all images from posts with maximum number and without featured image
- Display featured image as post thumbnail
- Scan for first image in post and display it [duplicate]
- Change featured thumbnail based on screen size
- Show a featured image with “Link” Post Type?
- get_post_thumbnail_id() not getting correct featured image after post edited
- the_ID & wp_get_attachment_image_src(the_ID(), “medium”) blank
- 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