There is no such filter to do that directly.
The only way is intercept the post’s content and modify it:
add_filter( 'the_content', 'FilterImages', 0 );
function FilterImages( $content )
{
// parse $content looking for <img .... />
// modify $content if it needs to be modified
return $content;
}
I managed to do what I needed to do with some string manipulation.
I guess also DOMElement can be used if the content manipulation task is not trivial.
Related Posts:
- Change html structure of all img tags in WordPress
- Change html structure of all img tags in WordPress
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Filter to remove image dimension attributes?
- WP 4.4. responsive images browser choosing the “wrong” one
- Remove images (files) that were generated when using add_image_size()
- Using Images in WordPress – Best Practices
- Change WordPress image URLs via filter
- Always use for post images
- Default Image Link Removal
- Remove title attribute from images
- hook into completed image upload filter
- How to create thumbnails with a fixed width, so all of them will have the same width?
- Creating a rotating header /image slider using theme customization
- Need help building a filter to edit the output of “image_send_to_editor”
- Adding HTML within an image title attribute
- Filter Media Library by author or post_parent
- Preview Image Path in Admin Section
- How to display a shortcode caption somewhere other than the_content
- Alter image output in content
- How can I remove the image attachment ALT field?
- How do I delete thousands of unattached images?
- add data-attribute to all images inside the_content()
- Filter to modify post_title after image upload?
- How to remove link from an image in a post?
- Limit author image size
- Setup A Default Featured Image
- Disable wordpress image sizes generation
- What’s the best “insert all images” plugin?
- Any way to “combine” galleries or show multiple galleries as one?
- Extend core block attributes in post content
- What’s the proper way to use the get_image_tag filter?
- Remove image classes from post thumbnail output
- How to get image ID to use inside wp_read_image_metadata()?
- How can I make all post image uploads have data-width and data-height attributes automatically by default?
- Photography Based Design – Multiple Images Per Post
- wp_upload_bits does not retrieve images that do not have an extension
- Is there any action/filter hook to use when an image gets edited in the editor?
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- How to add custom classes to figure element only if image has caption?
- Get ALT attribute from title post (code not work)
- Change align classes for images
- How to filter the image embed code based on link type
- Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1
- Add custom text in the media library image meta area
- WP 5.3 Removing Default WordPress Image Sizes
- Redirect to another page using contact form 7? [closed]
- How to check for images before echo
- Remove height attribute from wp_get_attachment
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Remove Image Sizes in Media Settings Page
- Images give 404 after changing default domain
- How can I use wp_save_image_editor_file filter?
- Need custom picture field for pages
- How to stop WordPress from completely overriding my tags in my templates?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Disable save as image on smartphones using all browsers ( chrome, firefox, ie, cm, opera )
- Prevent WP from wrapping html in caption shortcode after ‘image_send_editor’ filter is applied
- Apply nextgen-gallery lightbox effect [closed]
- How can I change the to for lazyload wp smilies
- How to pass on a value as parameter via url to another page
- How to display a warning when an uploaded image is too small?
- How to change an image source when rendering on frontend?
- How to change Gallery image url in product page ? In function.php?
- How to get title of images in post content
- How to generate alt attributes with php / filters?
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- How to make image uploads default to full size?
- js alert in add_filter function for image_send_to_editor
- WordPress 404 Images – Images not found after deleted from media
- Alt attribute is not showing while the value is given in Media
- WooCommerce Variation Swatches and Photos – get attribute thumbnail
- Get “Image CSS Class” value from the Advanced Options section
- Unable to delete images in Media Library
- How to attach post ID to image links in WordPress tinymce editor
- image_send_to_editor filter – Unwanted paragraphs and line breaks
- How might one programmatically set the link for all images in all posts?
- Image filter works on attachement pages but not posts. I can’t get the image ID
- Surround uploaded image link with div
- How to add multiple images in a page
- Only User Upload image Http Error
- Removing image dimensions from `the_content`
- Rename uploads filenames to POST-ID on upload
- Remove “align” attribute on images
- Upload button in metabox not working
- Saving a post, content filtering and user levels
- Slider do not add alt attribute. Cant get alt attribute from a media library!
- How do I add a nested conditional within an echo – to use a default image if there isn’t one in the post?
- Why images are disappearing on WordPress web site?
- Img alt tag showing different value then entered
- Featured Image not changing
- Uploaded Media Images on Site
- I tried to move the featured image below the paragraphs but now it is displaying twice
- How to add a link to media file for every image inserted in content?
- Replace Woocommerce Images
- Do I need to resize an image to fit the post?
- Is it possible to split Default WP Media directory to multiple Folder/Subdomain?
- Images showing in editor but not in post [closed]
- WordPress 5: including larger thumbnail image sizes in srcset than I have set
- Uploaded images appear broken in WP 4.4