Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm currently writing a plugin modifying the post content with the wp_insert_post_data filter. While doing that I would also like to add a post thumbnail using an external image url. It doesn't really matter if the image is hotlinked or copied to my wordpress installation. Anyone knows how to go about that?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

you should have a look to this blog post : http://www.maverick.it/tech/create-thumbnails-using-wordpress-built-in-functions

then, if you can't use a remote image, just download it as a temporary file on your server, process and delete it.

One your image created, you should then insert it as an attachment (http://codex.wordpress.org/Function_Reference/wp_insert_attachment) and set it as the post thumbnail (http://codex.wordpress.org/Function_Reference/set_post_thumbnail)

I hope it will help.

Cyril.

share|improve this answer
add comment

Hotlinkig is inherently evil.

Just host the images on your own server. Use WordPress built-in Media Management to attach the images to your posts, and to designate them as featured images (i.e. post thumbnails).

share|improve this answer
add comment

This may help?

http://epicplugins.com/external-url-link-to-featured-images/

It's a plugin that lets you set your featured image from an external image URL.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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