The function wp_get_attachment_image_srcset() delivers the srcset information of an image.

Is it possible to write a seperat function to add an additional extension (.webp)?

Output of the function wp_get_attachment_image_srcset():

"https://www.url.de/wp-content/uploads/teaser-768x512.jpg 768w, https://www.url.de/wp-content/uploads/teaser-500x333.jpg 500w"

Output of the new function with ".webp" extension:

"https://www.url.de/wp-content/uploads/teaser-768x512.jpg.webp 768w, https://www.url.de/wp-content/uploads/teaser-500x333.jpg.webp 500w"

Thank you for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.