Import failer error:503

Closed

Import WP Updated 4 months ago 18 Replies

saud asked 4 months ago on January 4, 2024 at 11:00 am

Hello,

I am trying to import the XML file which is around 63 MB but when uploading it shows an error “import failed error:503”

 

J

James replied Support Agent

4 months ago on January 4, 2024 at 11:20 am

Hi Saud,

Can you attach any server error logs so that i can try to diagnose your issue.

For reference a 503 error: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

James

sP

saud replied

4 months ago on January 4, 2024 at 11:31 am

attached the debug.log

J

James replied Support Agent

4 months ago on January 4, 2024 at 11:34 am

There are no errors in that log relating to the mentioned 503 error.

As an alternative method, can you try FTPing the file to your web server, then use the remote file option when creating the importer to attach it that way?

sP

saud replied

4 months ago on January 4, 2024 at 12:08 pm

i have upload the file on the server. this is the file path  "https://aap.mmag.in/wp-content/uploads/2024/01/aamaadmiparty.WordPress.2024-01-03.xml"  and when i try to enter this in the remote file and hit download button it goes to the next section where is select the /rss and this error shows "Config Index File Not Found: /home1/wwwmmiun/aap.mmag.in/wp-content/uploads/importwp/temp-config-862714.json.file_index-rss

J

James replied Support Agent

4 months ago on January 4, 2024 at 12:12 pm

This looks like a default wordpress export file, instead from the dropdown choose "/rss/channel/item"

sP

saud replied

4 months ago on January 4, 2024 at 12:17 pm

how to add category, how to add attachements?

J

James replied Support Agent

4 months ago on January 4, 2024 at 12:19 pm

https://www.importwp.com/section/how-to-guides/

sP

saud replied

4 months ago on January 4, 2024 at 12:25 pm

  • <category domain="post_tag" nicename="economy">
    • Economy
    </category>
  • <category domain="post_tag" nicename="election">
    • Election
    </category>
  • <category domain="post_tag" nicename="news">
    • News
    </category>
  • <category domain="category" nicename="politics">
    • Politics
    </category>
  • <category domain="post_tag" nicename="politics">
    • Politics
    </category>

    when i select the category all the tags are selected
J

James replied Support Agent

4 months ago on January 4, 2024 at 12:27 pm

You can use xpath to select specific taxonomies:

{/category[@domain="category"]}

or

{/category[@domain="post_tag"]} 
J

James replied Support Agent

4 months ago on January 4, 2024 at 12:30 pm

Looking at your wordpress export file there is no link to the attachments, the best you can get is the attachment id "_thumbnail_id", but there is no way to use that to fetch it from the old site:

{/wp:postmeta[wp:meta_key="_thumbnail_id"]/wp:meta_value}
sP

saud replied

4 months ago on January 4, 2024 at 12:33 pm

But on the remote site there is some featured image attached to the post

J

James replied Support Agent

4 months ago on January 4, 2024 at 12:51 pm

Yes there is, as the _thumbnail_id meta value is 116 , but this can not be used to fetch an attachment from the old site, you would need the url of the attachment.

A solution to this would be to add a custom script to the old site:

add_action('init', function () {

    if (!isset($_GET['iwpkey']) || $_GET['iwpkey'] != 'abc123') {
        return;
    }

    $id = isset($_GET['id']) ? $_GET['id'] : '';
    $path = get_attached_file($id);

    if (!empty($path)) {
        $mime = mime_content_type($path);

        header('Content-Type: ' . $mime);
        header("Content-Disposition: attachment; filename=" . basename($path));
        header('Content-Length: ' . filesize($path));
        readfile($path);
    } else {
        status_header(404);
        nocache_headers();
        die();
    }

    die();
});

This will allow you to download attachments from the old site using the url:

https://your-old-website.com/?iwpkey=abc123&id=#

Replacing the https://your-old-website.com with your old url.

And then setting the attachment url in the importer to be:

https://your-old-website.com/?iwpkey=abc123&id={/wp:postmeta[wp:meta_key="_thumbnail_id"]/wp:meta_value}

(screenshot attached showing the attachment setup in the importer, if you then preview the url in your browser that it shown in the preview under the field, this should show you the attachment on the old site or download it)

sP

saud replied

4 months ago on January 4, 2024 at 1:05 pm

should above script wrap into <script></script>

J

James replied Support Agent

4 months ago on January 4, 2024 at 1:50 pm

I have included the code in a plugin, you should be able to install and activate this

sP

saud replied

4 months ago on January 4, 2024 at 1:51 pm

In my XML file i have 3465 post but when importing it shows 7498

J

James replied Support Agent

4 months ago on January 4, 2024 at 1:54 pm

Is your wordpress export file just posts? or is it other post types e.g. pages / attachments.

If so you can filter the importer to only import posts on the run importer step under filter rows click on add row and set it to:

Skip: 

{/wp:post_type}

Text Not equals

That:

post

 

sP

saud replied

4 months ago on January 4, 2024 at 1:55 pm

No i have only post type post

J

James replied Support Agent

4 months ago on January 4, 2024 at 1:59 pm

Your xml file has 4014 records with the attachment post type:

<wp:post_type><![CDATA[attachment]]></wp:post_type>