Duplicate images when updating posts via CSV

Closed

Import WP Updated 1 year ago 5 Replies

Eduardo asked 1 year ago on July 20, 2023 at 3:17 am

Hello everything is fine?

 

My name is Eduardo Boeing. I’m using the Import WP plugin and I have to praise it: the plugin is simply amazing.

 

However, I noticed a rather serious bug: whenever I need to update my posts, I export them all and edit them via CSV.

 

The problem is, when I import back into WP, to update the existing posts, the plugin simply duplicates all the post’s featured images with a small change to the image URL.

 

For example, the image had the URL example.com/a-example-image.webp. On import, Import WP duplicates this image with the URL example.com/a-example-image-1.webp.

 

If I keep updating my posts, the images keep getting duplicated, and the “-1” in the URL, after multiple updates, can leave the URL like this: example.com/a-example-image-1-1-1-1- 1-1-1.webp

 

I noticed this just now and am suggesting the fix as I really love the plugin and its ease.

 

Thank you very much!

J

James replied Support Agent

1 year ago on July 20, 2023 at 9:38 pm

Hi Eduardo,

Thank you, I am glad you like using the plugin.

The bug you mention brings into question of how the importer checks to see if an attachment should be re-downloaded or if it should use an existing.

Say for example if a image has been imported from an external url, this image has a hash generated for it based on that url, so when you then use the exporter to generate a csv it creates a local url relative to your website, so when this is imported after your changes have been it is looking for a hash based on your local url, and it will not match the original external image hash.

However in the meantime while i try to think of a better solution, on the importer that is importing the modified csv file, if you go to the attachments sections and toggle the attachment settings, Changing the "Download" field to Media library, this will check the media library for existing images.

This will however stick with the latest url attachment, based on your example this would be "example.com/a-example-image-1-1-1-1- 1-1-1.webp" , i would recommend modifying this in the csv back down to example.com/a-example-image.webp

James

EB

Eduardo replied

1 year ago on July 21, 2023 at 11:18 am

Wow, this plugin has a lot more functions than I imagined. It's really amazing. Thanks for the help, James! Just another question. When I change the title of my posts through Import WP CSV, the URLs of the posts also change (slug). Is there any way to keep the URLs even changing the title?
J

James replied Support Agent

1 year ago on July 21, 2023 at 12:21 pm

Do you have the post_name or slug field enabled, using this will stop the slug being changed by the title.

EB

Eduardo replied

1 year ago on July 21, 2023 at 7:33 pm

I managed to do everything I wanted and I also learned a lot about the plugin. Thank you very much, James.

I'd love to rate the plugin, both for features and support.

J

James replied Support Agent

1 year ago on July 22, 2023 at 11:06 am

Hi Eduardo,

Thank you, I am glad you liked the plugin, its one of the main reasons i continue development.

I am unsure of what version you are using, but you can either leave a review:

ImportWP Pro: https://codecanyon.net/item/importwp-wordpress-xml-csv-importer/reviews/19703181

ImportWP: https://wordpress.org/support/plugin/jc-importer/reviews/

James