srcset broken with special characters
-
Hello,
when uploading an image containing “@” in its name and using wp_get_attachment_image_srcset the returned data is always false.
I debugged this and it’s caused by the loop of wp_calculate_image_srcset. Specifically the code between 1078-1080
if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) { $src_matched = $is_src = true; }While
image_srcis provided by you and contains the full url with the escaped “@” (%40) the strpos second parameter have the plain @. This causes the src_matched to never get set to true resulting in “return false” later in the code.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘srcset broken with special characters’ is closed to new replies.