Take a closer look at get_image_tag() which can take a lot of parameters like $id, $alt, $title, $align, $size.
If you look even closer you’ll find the get_image_tag_class filter to change the image class names (like class, ID, align and size).
You can use the filter within your functions.php like this:
Note: This will still return an empty tag like: class=""
function strip_image_class($class, $id, $align, $size) {
return '';
}
add_filter('get_image_tag_class', 'strip_image_class', 0, 4);
Update: To completely remove everything related to the class you’ll have to filter the $html:
function strip_entire_image_class($html) {
return preg_replace('/ class="(.*)"https://wordpress.stackexchange.com/", '', $html);
}
add_filter('get_image_tag', 'strip_entire_image_class', 0, 4);
Related Posts:
- How to add a class to the attachment images
- How do I hook into WordPress to save an uploaded photo as an alternate size to an existing photo?
- How to check if image is already stored in a site’s post database? (network)
- Change the filename format of saved featured images
- How to draw media details for Isotope gallery using Photoswipe
- How to register images uploaded via FTP in media library?
- Permanently remove first image from posts
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Debugging upload problem: What part of WP does actual image-resizing?
- Add custom image sizes to media uploader
- Conditional Statement – check if post has an attachment image
- How to upload imagick resource to media in wordpress
- Use Filename for Alt and Title Tags
- How do I get images (with a thumbnail preview) to show in search results?
- Add custom HTML to posts page
- Additional image sizes are not being generated
- Adding a querystring to an image URL when clicking ‘insert into post’?
- Assign a picture URL to a page via PHP
- How to insert a local image with custom size
- Change logo based on incoming domain
- How to scale image with equal width and height without distortion?
- Theme currently showing thumbnails, how to show full size?
- Validate Uploaded Image using WordPress’ Built-in Functions?
- Get most recent media upload
- Convert all images to PNG on file upload
- Escape post image attachments added to template
- Auto crop images in WordPress
- Display post image with fancybox
- Echo URL of large version of Featured Image
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- Cannot display or echo alt text on featured image
- Recent posts with featured image or fallback image with permalink
- Set the background to a default image if there isn’t a specified “featured image”
- Mass update excerpt
- How to control WordPress image metadata (using Imagick)?
- How to get next image with this code from same post?
- Can’t upload image using media_sideload_image
- How to use thumbnail size of image if I’m only using src to get image
- get_children displaying images removed from the page
- Why my image upload button is not working in wordpress widget area?
- “imagejpeg” function is not working in wordpress
- Display image from an external rss feed on wordpress without plugins
- WordPress function when file is uploaded, deleted or edited
- Download images from media library to computer in BULK?
- Three Questions with Twenty Eleven theme
- How to loop through all the attached images in a post, and get their url one by one
- Division by zero error in image.php
- Clickable image link sends people to wrong URL
- Only show image from custom field when present
- Timthumb.php image gallery not working on Multisite WordPress
- Upload non-featured image to image field
- Change default gallery images – Currently they are displaying full size imagese
- I’m unable to call img path using single quotes in an array?
- Creating black and white copy of an image [closed]
- Get the id of all images in a post
- Display an image based on field value
- Else/If Statement to Display Photo Descriptions
- How to set a featured image (thumbnail) with PHP?
- Controlling image output size ACF repeater [closed]
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- WordPress İmages Upload & Delete Error
- Attaching images to posts manually (i.e. with custom code, without the use of an API)
- Adding a ‘style=’ bit to image_send_to_editor output
- How to internationalize header image?
- Some problems in custom widget
- Displaying images outside the content
- Checking page before applying image restrictions while uploading
- Generate images with html2canvas and the woocommerce api
- WordPress api post image raw data without being blank in media library
- Retrieve alt text by referencing the img src
- Show next image in array if page is revisited by same logged user
- WordPress loading all local images from specific directory?
- Update Images after edit via php
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- How do I stop an Image Address from loading in the Browser?
- How to get the url of the entry in which an image belongs
- How to add a PHP scripts into WordPress
- How to include different html tags in the header for different pages?
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- How do I routinely extract the thumbnail of the most recent post?
- add class to background image
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Save the outputted image into the Media Library, with a different filename and extension
- How to resize an image server-side before upload?
- Creating image gallery in wordpress
- Image limit from 1 to 5
- Name Input from widget displays Sidebar name instead of saved data
- Gallery requires a featured image but does not show it in posts/pages
- Snapshot Theme from WooThemes — empty ‘alt’ attribute
- Changing 2011 theme header image based on user dropdown
- Setting post thumbnail sizes in template file and functions.php
- HTML in PHP problem [closed]
- An automatic way to crop images of different sizes
- How to automatically convert images to WebP on WordPress?
- Remove default Image Sizes
- Use URL query string in img src attribute
- Add/alter image attribute before render
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload
- How can add alt tag in following code. Image are showing dynamic in wordpress
- HELP PLEASE PHP slider css