The class
attribute contains the size in the format attachment-$size
, you could do a check for a specific size like:
if( strstr( $attr['class'], 'thumb' ) ):
// size is attachment-thumb
endif;
Related Posts:
- can’t output gray scaled image I’ve created using add_image_size
- Filter to remove image dimension attributes?
- Removing Image and Caption Dimension Attributes
- Changing JPEG compression depending on image size
- Change WordPress image URLs via filter
- Remove title attribute from images
- Disable resizing of gif when uploaded
- Add ‘if exists’ to filter
- Disable wordpress image sizes generation
- How to removes all instances of thumbnails displayed in my theme?
- wp_upload_bits Upload Specific Sizes Only
- Redirect to another page using contact form 7? [closed]
- Override has_post_thumbnail function
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- How to disable thumbnail filter for a specific template part or image size?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Removing URL and adding container around image in the featured image metabox
- How to apply filter on get_the_post_thumbnail()
- How to change Gallery image url in product page ? In function.php?
- Distinguish between page and post in function
- WordPress set featured image to first image of the post
- Set post featured image to author image
- Print url to default featured image
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- List all image sizes still getting disabled sizes
- changing size image within the content
- How to replace all images in all posts and pages with a different size?
- Wrapping Featured Image on Add/Edit Page in div?
- I tried to move the featured image below the paragraphs but now it is displaying twice
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX
- optimized PNGs 5X larger than originals
- Disable emojicons introduced with WP 4.2
- Missing feature image link function
- How to remove a filter that is an anonymous object?
- How to get image title/alt attribute?
- User-friendly cropping of post thumbnails?
- WordPress hooks/filters insert before content or after title
- How to add defer=”defer” tag in plugin javascripts?
- add_action(), add_filter() before or after function
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- How can I make add_image_size() crop from the top?
- What is the very earliest action hook you can call?
- No Thumbnails Generated
- How would one modify the filtering Gutenberg applies to pasted content?
- How can I modify the WordPress default widget output?
- Add custom options to the wplink dialog
- Remove classes from body_class
- what is __return_false in filters
- How to disable WordPress from creating thumbnails?
- add_image_size() for specific Post Types
- Stop wordpress from hardcoding img width and height attributes
- Explanation for apply_filters function and its variables
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- Programmatically get images by URL and save in uploads folder
- How do you get the post thumbnail size?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- Insert HTML just after tag
- the_content and is_main_query
- set_post_thumbnail_size vs add_image_size
- Minimum Dimensions Requirement for Featured Image?
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- The the_post_thumbnail without srcset?
- How to show page content in feed?
- wp_headers vs send_headers. When to use each?
- Generate Thumbnails only for Featured Images
- Get the first image from post content (eg.: hotlinked images)
- How to get all featured image sizes and their URLs?
- Filter any HTTP request URI?
- How to Pass External Variables to Filters/Actions
- How to disable generation of default image sizes for some custom post types?
- How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)
- How to filter users on admin users page by custom meta field?
- Filter by one custom field, order by another?
- Not able to change wp_title using add_filter
- How to automatically add rounded corners to thumbnails?
- How do I change/modify the_post_thumbnail(); html output?
- How to appending to the_content using add_filter with custom post type?
- Query WP REST API v2 by multiple meta keys
- No filter of code on switch from html to visual editor, how?
- Display thumbnail only if requested size exists
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Sanitize and data validation with apply_filters() function
- How to modify posts_where filter only for the search query
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- How to get shortcode’s input values inside a filter?
- Download an image from a webpage to the default uploads folder
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to bulk delete all users with no posts?
- How many filter/action hooks are healthy?
- WordPress 3.9 – Trouble Editing TinyMCE 4.0
- How to add filter with 2 args?
- What’s the best way to use the Featured Image for responsive web design?
- Why is javascript allowed in my post content?
- Set JPEG compression for specific custom image sizes
- How to use update_{$meta_type}_metadata filter to modify meta value
- the_post_thumbnail responsive srcset not populating with custom image size
- How to wrap an element around an iframe or embed in content automatically?