Import-External-Images-2
Import-External-Images-2 copied to clipboard
wp_insert_post()
I add posts to wordpress using an external PHP script, something like this:
$new_post = array(
'post_title' => $title,
'post_content' => "blah blah <img src='https://example.com/image.jpg'> ";
'post_status' => 'publish',
'post_author' => $wp_user_id,
'post_type' => 'post',
'post_category' => array(),
'tags_input' => array()
);
$post_id = wp_insert_post($new_post, true);
But the images are not imported in the local library. The remote image is displayed in the post.
Is there a way I can use your plugin to import external images when posting from an external PHP script instead of using the WP admin dashboard to create a new post ?
Thanks
To be honest, the plugin needs a complete rewrite which will arrive much later in the year.
To do as you ask you would need to enter the dashboard and visit the plugin's settings page after your posts have been added to the site then run the image importer.