diff --git a/src/importer/class-tainacan-csv.php b/src/importer/class-tainacan-csv.php index e2304c91e..7ab71006e 100644 --- a/src/importer/class-tainacan-csv.php +++ b/src/importer/class-tainacan-csv.php @@ -411,7 +411,7 @@ class CSV extends Importer { } else if( strpos($column_value,'file:') === 0 ) { $correct_value = trim(substr($column_value, 5)); if( filter_var($correct_value, FILTER_VALIDATE_URL) ) { - $id = $TainacanMedia->insert_attachment_from_url($correct_value); + $id = $TainacanMedia->insert_attachment_from_url($correct_value, $item_inserted->get_id()); if(!$id){ $this->add_error_log('Error in Document file imported from URL ' . $correct_value); @@ -427,7 +427,7 @@ class CSV extends Importer { } } else { $server_path_files = trailingslashit($this->get_option('server_path')); - $id = $TainacanMedia->insert_attachment_from_file($server_path_files . $correct_value); + $id = $TainacanMedia->insert_attachment_from_file($server_path_files . $correct_value, $item_inserted->get_id()); if(!$id) { $this->add_error_log('Error in Document file imported from server ' . $correct_value); diff --git a/src/importer/class-tainacan-flickr-importer.php b/src/importer/class-tainacan-flickr-importer.php index 6977727b2..037682563 100644 --- a/src/importer/class-tainacan-flickr-importer.php +++ b/src/importer/class-tainacan-flickr-importer.php @@ -444,7 +444,7 @@ class Flickr_Importer extends Importer { if( isset( $image_url ) && $image_url ){ $TainacanMedia = \Tainacan\Media::get_instance(); - $id = $TainacanMedia->insert_attachment_from_url( $image_url, $inserted_item->get_id()); + $id = $TainacanMedia->insert_attachment_from_url( $image_url, $inserted_item->get_id() ); $inserted_item->set__thumbnail_id( $id ); $inserted_item->set_document( $id ); diff --git a/src/importer/class-tainacan-test-importer.php b/src/importer/class-tainacan-test-importer.php index 19d3f8f0b..01448a7e7 100644 --- a/src/importer/class-tainacan-test-importer.php +++ b/src/importer/class-tainacan-test-importer.php @@ -637,7 +637,7 @@ class Test_Importer extends Importer { $url = "https://loremflickr.com/$horizontal_size/$vertical_size/$keyword"; - $id = $TainacanMedia->insert_attachment_from_blob(file_get_contents($url), time() . '.jpg', null); + $id = $TainacanMedia->insert_attachment_from_blob(file_get_contents($url), time() . '.jpg', $inserted_item->get_id()); if(!$id){ $this->add_error_log('Error in imported URL ' . $url);