You can use the get_image_tag_class filter which passes the attachment ID as an argument:
apply_filters('get_image_tag_class', string $class, int $id, string $align, string|array $size)
So you can use:
function my_image_tag_class($class, $id, $align, $size) {
// Logic to check your attachment IDs
if($some_logic) {
$class .= ' no-lazy-loaded';
}
return $class;
}
add_filter('get_image_tag_class','my_image_tag_class');
If you have an array of attachment IDs you want to filter, your logic would be:
if(in_array($id, $your_array_of_attachments)) { ...
Related Posts:
- How can I make add_image_size() crop from the top?
- Resizing all images
- Way to force media uploader use custom image size
- Automatically Import Image into Posts from URLs on the Web?
- How can I attach images to a post from the media library?
- Rename existing old uploaded images containing accented French characters (not during upload)
- Thumbnail with different sizes
- Upload images from custom plugin using the media modal
- Disabling post images for not logged in users
- How to upload thousands of images?
- There’s some way to add a wrapper around posted images?
- How to get CMB2 to show a single image at a specific size
- How to show category images (from plugin) on a regular page (page-example.php)?
- Saving/Writing/Adding file to upload folder
- How to limit 1 image per post on homepage only?
- Flickr plugin that will display photos from multiple group pools? [closed]
- Getting media library popup in custom plugin admin page
- How to change ID of an attachment in wp_posts and its related tables correctly?
- bulk change of image setting “link to” to “link to: image url “
- Regenerate images with automatic ALT and TITLE attributes
- Images not showing after changing wp-content folder name
- Preview featured image using frontend post plugin
- How to Delete all Unused photos Function
- How to resize images due to container width automatically server side/without CSS
- Set featured image randomly from WordPress Database on post submission
- How to create a managed image repository in wordpress
- wp_generate_attachment_metadata is creating an empty array
- Contact Form 7 Get Image Function [closed]
- How generate 200% image size and save with suffix @2x
- Load external images via proxy
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- Retrieving Meta from Image Attachment
- Adding (image) caching to my Tumblr widget
- Image Manager Plugin [closed]
- Redirect to another page using contact form 7? [closed]
- Slider/text combination plugin
- Adding Static Image to WooCommerce Content-Single-Product template
- How do I get a post author’s image/avatar via RSS from another blog?
- In Woocommerce theme need to add custom external link [closed]
- Photo Gallery Plugin and Touch Devices
- Skewed / slanted button within elementor [closed]
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Plugin for an interactive image? [closed]
- How to fix broken media library?
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- How to get images using taxonomy ( WP Media Folder)
- adding Adsense’s In-Article Ads between images of blog post
- Add “Featured Image” box in my plugin post page
- Blurry images when loading the page first time
- Image Galleries for website migrated from .com to .org
- JSON API Plugin not showing Attachments id reused
- How do I link an image in my plugin so it displays on WordPress?
- Some images on WordPress site are suddenly gone
- Regenerate Thumbnails Plugin successfully updated my thumbnails but image src won’t change to new image size?
- Add_image_size not generating correct size
- Is there a way to insert multiple images into a post at the same time without using a gallery?
- Multiple images per post – Show random image elsewhere
- Replace image urls(absolute instead of relative) by using filter in single page
- Looking for a photo management solution
- I’m having several WP issues, especially with missing images
- Simple sildeshow/image-upload plugin?
- Elementor Pro display featured image on section -> style -> image using shortcode
- Can export gallery but can’t import it Wp all import
- how to remove share button from image overlay
- How to hide featured images of all posts falling under the same category in wordpress?
- Bulk Image Resize for Media Library, but for ENLARGING instead of Shrinking
- Upload Image with a file URL and show dynamically on Frontend
- Enlarge an image slider when click
- insert og image link in wordpress post
- WordPress built-in compression of images? How well does it compare to Photoshop or Shortpixel?
- Display Multiple Photos as Featured Image when mouse moves on to it post
- How to Upload images to a custom folder in upload folder using media uploader
- what functions to use to resize images and create DB metadata for them after/during upload?
- Product Page loads terribly slow when product gallery images are added
- WordPress create thumbnails on demand
- Implementing Scrollable Images
- Uploading images to custom table
- How to wrap image tag into div for post only?
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- Theme Load Error
- Images not showing on homepage after migration [duplicate]
- how to open image gallery in a post/page?
- Server Path Information
- Determine if get_the_image has image on Get the image Plugin
- Display alt text as tool tip on page
- Retrieve post thumbnails
- How to make plugin work in each template in wordpress
- Image Layout in Posts
- How can I manage the background image of a slider based on the featured image of a page?
- getting image alt text via ACF plugin in WordPress [closed]
- how to add “alt” for all image in wordpress
- Allow users to download media files directly from Amazon S3 (AWS plugin)
- How should I force WordPress to give proper name for the uploading images?
- How to display multiple images in the before and after plugin?
- Woocommerce resize existing product images
- How to Add a Website Background Image to One Page?
- Want to show pop up image on home page every time when i refresh it [closed]
- how to embed a crop feature for cropping images uploaded by the user
- How do i display the number of images on the “post screen”
- Edit Image button disappears when I make WordPress use Imagick instead of GD