X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/f6364df6999f38896cc58171ec4a503f4f2dedcf..e9d988989fe37ab8c5f903e47fbe36e6e00dc51f:/wp-admin/includes/import.php diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index 51861bdc..f57be766 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -80,12 +80,17 @@ function wp_import_handle_upload() { $object = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, - 'guid' => $url + 'guid' => $url, + 'context' => 'import', + 'post_status' => 'private' ); // Save the data $id = wp_insert_attachment( $object, $file ); + // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call + wp_schedule_single_event( time() + 86400, 'importer_scheduled_cleanup', array( $id ) ); + return array( 'file' => $file, 'id' => $id ); }