I'm building a shortcode that display's a list of items from a public API, that each have a thumbnail URL. If I use the URL as src attribute, I create a request to their server for every image.

I want to prevent hot linking their images by caching them. I imagine the function to create the img-tag could cache every image it displays. Then, when it's to be displayed again, the URL is recognized, and I can link the cached image instead.

Is there a WordPress solution available for caching images so that they don't appear in the media library? I could use the file system and save them in a separate uploads folder, but if there is a standardized way, I would prefer that.

The list itself is already cached using transients.


Your Answer

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

Browse other questions tagged or ask your own question.