Archive for January, 2012


Attaching image to post from external url wordpress

Its very simple to attach image from any external url to post by code.
Here is the simple code that will attach image to your post.

set_time_limit(300);
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
$upload = media_sideload_image('IMAGE_URL', "POST_ID", "IMAGE_DESC");
die ( $upload );

:)

source:stackoverflow.com
Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories