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.

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 );

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