Bug Description
WordPress core has a mechanism to disable responsive images through some filters.
add_filter( 'wp_calculate_image_sizes', '__return_false' );
If we disable responsive images, the Enhance Responsive Image plugin still adds the Picture and source. The expected output should be return early only IMG tag.
Steps to reproduce
- Add
add_filter( 'wp_calculate_image_sizes', '__return_false' ) in your functions.php
- Activate the Modern Image Formats plugin and enable picture support from the Media Settings screen.
- Add an image block
- Preview the page in the front end, See the error.
<picture class="wp-picture-28" style="display: contents;">
<source
type="image/webp"
srcset="
http://localhost:8888/wp-content/uploads/2024/08/car-1024x576-jpeg.webp 1024w,
http://localhost:8888/wp-content/uploads/2024/08/car-300x169-jpeg.webp 300w,
http://localhost:8888/wp-content/uploads/2024/08/car-768x432-jpeg.webp 768w
"
>
<source
type="image/jpeg"
srcset="
http://localhost:8888/wp-content/uploads/2024/08/car-1024x576.jpeg 1024w,
http://localhost:8888/wp-content/uploads/2024/08/car-300x169.jpeg 300w,
http://localhost:8888/wp-content/uploads/2024/08/car-768x432.jpeg 768w
"
>
<img fetchpriority="high" decoding="async" width="1024" height="576" src="http://localhost:8888/wp-content/uploads/2024/08/car-1024x576-jpeg.webp" alt="" class="wp-image-28">
</picture>
Screenshots

Bug Description
WordPress core has a mechanism to disable responsive images through some filters.
If we disable responsive images, the Enhance Responsive Image plugin still adds the
Pictureandsource. The expected output should be return early only IMG tag.Steps to reproduce
add_filter( 'wp_calculate_image_sizes', '__return_false' )in your functions.phpScreenshots