Best WordPress Hosting
 

New filter to modify content images in WordPress 6.0

via make.wordpress.org => original post link

WordPress 6.0 introduces a new filter  wp_content_img_tag to allow adjustment of images in a blob of HTML content, most prominently post content via the_content filter.

WordPress 5.5 originally introduced the wp_filter_content_tags() function to modify certain elements, primarily images, in a blob of HTML content. Prior to the WordPress 6.0 release, it was not possible to alter these image tags without duplicating the complex regex logic in the wp_filter_content_tags() function. This increased complexity and overhead. The new wp_content_img_tag filter solves this problem.

How to use the filter