We are currently on vacation until 21st July 2025, ticket responses maybe be longer than normal during this period, sorry for any inconvenience.

Urgent : Help with uploading multiple images from XML for Custom Post Types

Pending

Import WP Pro Updated 2 days ago 17 Replies

Prafull asked 3 weeks ago on July 11, 2025 at 9:00 pm

Hello,

We want to upload multiple images from source XML file and after upload, serialized array of media ids of uploaded images are saving inside custom field.

Can you tell me how can we do that?

Below are the data we have so far:

<AdditionalImages>
      <Image>EXTERNAL_URL_TO_IMAGE_1</Image>
      <Image>EXTERNAL_URL_TO_IMAGE_2</Image>
      <Image>EXTERNAL_URL_TO_IMAGE_3</Image>
      <Image>EXTERNAL_URL_TO_IMAGE_4</Image>
</AdditionalImages>

Destination field rem_property_images contains value as serialized array like below:

a:20:{i:5016;s:4:"5016";i:5017;s:4:"5017";i:5018;s:4:"5018";i:5019;s:4:"5019";i:5020;s:4:"5020";i:5021;s:4:"5021";i:5022;s:4:"5022";i:5023;s:4:"5023";i:5024;s:4:"5024";i:5025;s:4:"5025";i:5026;s:4:"5026";i:5027;s:4:"5027";i:5028;s:4:"5028";i:5029;s:4:"5029";i:5030;s:4:"5030";i:5031;s:4:"5031";i:5032;s:4:"5032";i:5033;s:4:"5033";i:5034;s:4:"5034";i:5035;s:4:"5035";}

In this serialized array key and value both are Media Ids generated after uploadign images.

Can you help us to figure out how can we acheive this final result whcih will save in database for above Source XML?

J

James replied Support Agent

3 weeks ago on July 12, 2025 at 3:45 pm

Hi Praful,

To import a serlalized list of attachment ids you would need to use the custom field section, set the field name to rem_property_images , and select the custom field type of "Attachment", and under its settings set the return type to "Attachment ID - Serialised".

Based on your XML you would set the value to "/AdditionalImages/Image"

James

PK

Prafull replied

2 weeks ago on July 15, 2025 at 1:51 pm

Hello James,

Thanks for the reply and it did the trick and worked like we wanted.

We got another scenario, we have to import 2 fields data inside one field in wordpress.

In wordpress we have custom field rem_number_of_units, In our XML file we are getting this details with 2 fields as below:
<NumberofBuildings>1</NumberofBuildings> or <TotalNumberofBuildings>1</TotalNumberofBuildings>

File contains only either of field from above two. both fields are not exist together with properties.

So, do we have to do 2 mappings of same wordpress custom field?

Let us know.

Thanks,
Prafull

J

James replied Support Agent

2 weeks ago on July 16, 2025 at 1:49 pm

You should be able to select from multiple parts of your xml file into a single importer template field by using the data selector?

PK

Prafull replied

2 weeks ago on July 17, 2025 at 9:17 pm

Hello James,

If I want to run importer using CLI, then how can I do that?

As I am seeing on this documentation https://www.importwp.com/docs/, there is no guidelines for it.

Thanks,

Prafull

PK

Prafull replied

2 weeks ago on July 18, 2025 at 5:21 pm

Hello,

I also have a concern over how cron runs. I setup cron but it was never run.

How can I assign folder path and from where cron will take file and import data into the system. I had setup with Local Folder and provided path to file but when data in file changes I have to always press download button on file settings manully to allwo that file import process. How can we allow to run import process every day to pick file with given path and start import process?

Thanks,
Prafull

PK

Prafull replied

2 weeks ago on July 18, 2025 at 5:26 pm

See attached screenshots for my previous message.

With these settigns cron was not running at all.

J

James replied Support Agent

1 week ago on July 21, 2025 at 8:03 pm

Hi Prafull,

Running an importer via wp-cli, all you need to do is 

wp importwp import <import_id> --start

for example if you had an importer with the id of 5 the command would be the following:

wp importwp import 5 --start

James

PK

Prafull replied

1 week ago on July 21, 2025 at 8:05 pm

Here import_id is the post_id I can see in URL when I am viewing any importer?

J

James replied Support Agent

1 week ago on July 21, 2025 at 8:06 pm

In regards to the cron setup, you import wp settings seem correct to run the importer every 30 minutes past the hour, from the ....output_test_latest.xml file.

Do you know how your wordpress website cron is setup? have you configured it to run via a cron job or task scheduler: https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/

James

 

J

James replied Support Agent

1 week ago on July 21, 2025 at 8:08 pm

Yes the import id is the "edit" argument value when viewing the importer (5 in the following example),

e,g, http://localhost:8888/wp-admin/tools.php?page=importwp&edit=5&step=0

 

PK

Prafull replied privately

1 week ago on July 23, 2025 at 10:37 pm

J

James replied Support Agent

1 week ago on July 24, 2025 at 7:38 am

Does your server have any error logs that you can share to help solve this issue?

PK

Prafull replied privately

1 week ago on July 24, 2025 at 3:13 pm

PK

Prafull replied privately

1 week ago on July 24, 2025 at 8:27 pm

PK

Prafull replied privately

1 week ago on July 24, 2025 at 10:05 pm

PK

Prafull replied

3 days ago on July 28, 2025 at 3:36 pm

Hello James,

I have a question about downloading a file from remote server and then import data into wordpress website.

But the problem is that I have to provide URL for downloading file like below:

REMOTE_URL/datafeed/CURRENT_DATE

REMOTE_URL = 3rd party domain

CURRENT_DATE = date of the day when cron run (This will be dynamic value)

This URL is like API and I need to send Authentication API key in request header like we do using cURL in PHP.

After that it will give me XML data file which will then get imported in the website.

So, how can I configure this with Import WP plugin?

Thanks,
Prafull

J

James replied Support Agent

2 days ago on July 29, 2025 at 9:13 pm

Hi Prafull,

You could achieve this by writing a custom script to do the following:

1. Intercept a url on your website e.g. www.yourwebsite.com/?custom-fetch=1 , you would then put this url in the importer as the remote url.
2. On interception the code would remote fetch from your mentioned api allowing you to set the current date, authentication key and any other request headers needed. then returning the result to the importer which would then be imported.

Does that sound correct, is this something that you need help implementing send on all the information needed to connect to the api and i can see what i can do.

James