Just as Tom mentioned in the comments above. The fourth parameter of wp_get_attachment_image
sets the value, not adds to it so it will override the auto generated class.
If you need the size class and your custom class you can simply add both of them manually like so…
echo wp_get_attachment_image( $image_id, 'image-size', '', [
'class' => 'some-class attachment-image-size size-img-size'
] );
I
Related Posts:
- Missing feature image link function
- Generating Responsive Background Image Sizes in PHP
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Display height and width properties with the_post_thumbnail() or related function
- Removing the first image in content
- Function to auto-set a featured image that is already in use
- Overwriting Parent Theme’s Image Sizes
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- show first 3 thumbnails of posts in different sizes [closed]
- Set spesific size of featured images
- Can’t generate thumbnail images
- How to hide image-url if no attachment?
- How to add a new image size and apply it to posts only?
- Featured Image keeps cropping
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Can You Set A Minimum Image Dimension For Resizing Images?
- Featured image on archive page based on post type
- Printing medium sized image
- Full size image option removing problem
- Image width issue in IE [closed]
- image_size with respect to aspect ratios
- add_image_size() parameter four ($crop = true) is ignored: the_post_thumbnail() returns scaled image(s) instead of hard cropped
- Add image size if page template
- How do I change/modify the_post_thumbnail(); html output?
- Set JPEG compression for specific custom image sizes
- remove links from images using functions.php
- Issue with wp_get_attachment_image() and SVG file type
- How to change the markup WordPress inserts for post images
- Programmatically Set First Image as Featured
- Removing default image size list in Media Box
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Automatically set the featured image
- WP 4.4. responsive loads normal image after loading the responsive image
- How to add classes to images based on their categories?
- How to create thumbnails for PDF uploads?
- Get recent posts with thumbnail
- How to reduce original image quality on upload?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- How do I use element instead of tags in WordPress post content having webP support?
- Add options to featured image
- Is it possible to maintain image aspect ratio when scaling images?
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- Linking thumbnail to full size image
- Set image size on media and text block with a function
- Create thumbnail on PDF upload with Gravity Forms
- Gallery images titles – get from post
- Remove images from get_the_excerpt
- Add a Post Thumbnail to an RSS Feed with custom size
- Use Exact Image Size using add_image_size
- Make WordPress size and name images for Retina.js
- How to add a rel attribute to images that contains their categories?
- the_post_thumbnail fallback using hooks
- Insert width & height attributes to all images displayed on each page
- Setting featured image with function, 1 part not working
- Custom image size in Media Dropdown
- Best way to programatically add “rel” attributes to page and post images
- How to set the jpg image compression for specific thumbnail sizes?
- Actions according to image type and size
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Overwrite Parent Theme add_image_size in Child Theme
- Images uploaded using media uploader are appearing upside down
- How to add css class to image attached in all the posts?
- Add custom image size not working
- img width and height attributes being set by get_the_post_thumbnail
- Count total number of images in post and echo results as number
- Get the 5 lastest Featured Posts from a category
- How to display a default image for post thumbnail using functions.php?
- How can you limit srcset on a single type of page?
- how to add an image to the footer?
- Change size and crop medium_large images
- Getting Featured Image Caption to Only Show if Populated
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Add Featured image column into wordpress admin on pages AND posts
- Automatically wrap multiple images in div
- Post thumbnail not showing in WP admin area for custom post type
- Understanding and altering the structure of posted images
- Set the background to a default image if there isn’t a specified “featured image”
- Backstretch.js and thumbnail sizes to reduce loading time
- set_post_thumbnail when user is not logged in
- Image rotation fails to regenerate custom sized thumbnail
- Publish/Update post is changing image links from file url to post url
- Featured Image Thumbnail Creation
- Twentyten Child Theme: header images display messed up in admin panel
- Disable auto-resizing of uploaded images, but only for certain filename
- How to stop twenty fifteen theme from cropping featured images?
- Display images that are not in the content
- Remove after images
- Getting custom image size URL in functions
- media resize/crop possibilities?
- Redirect to another page using contact form 7? [closed]
- It does not work concatenation in function.php
- Random Featured Image Based on Category
- Control the srcset much more (not all sizes in it each time)
- How to retrieve the current post’s generated featured image size?
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- srcset and custom field get_post_meta and wp_get_attachment_url
- Limit dimensions of “Full” size images
- Visual Composer creating own shortcodes with vc_map() to return simple Image