Archive for January, 2012
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 );
Total Views: 460 Today Views: 0source:stackoverflow.com