Doing a huge overhaul of my website mainly for page load performance, I want to filter the caption shortcode in the_content to load the thumbnail version of the image if wp_is_mobile() returns true. If not, load the size set in the shortcode.

What is the right filter to do so?

  • and I did disable srcset because they were always loading the regular-sized image, even on mobiles...
    – Lazhar
    Sep 13, 2016 at 10:55

1 Answer 1


Maybe you should read this. It explains how to achieve what you are looking for. Be aware of wp_is_mobile() function if you are using any cache system, it would result in some unexpected behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.