WordPress Importer
Media library import works (3 posts)

  1. Andrzej
    Posted 1 year ago #

    fyi. After struggling to migrate all content from one site to another, I found that media library content failed to import per messages like:

    Failed to import Media "googlemapsicon"

    It was mentioned elsewhere that the WordPress Importer must have direct URL access to the media source directory. Since our source site was secured with .htaccess settings, I temporarily renamed the file before doing the import. All media was then successfully imported without errors! .htaccess was then restore as the source website.

    I can say that the WordPress Importer does the job nicely - with some caveats. If the WordPress Importer plugin was tweaked to recognize source permission issues and report them accordingly, it could become the best solution for site migration.

    -Cheers for the WP team


  2. Andrzej
    Posted 1 year ago #

    I should describe our destination site, hosted by Bluehost. It has a fresh WP 3.8.1 installation at a subdomain of our primary domain. Our primary site is also running 3.8.1. Both site memory limits were set at 64MB. WP Export was run with the "All content" option to produce a 4.09MB XML file.

    Before importing the XML, I installed all plugins that may have anything to do with custom "post types". Otherwise, the import operation failed with:

    Failed to import "Scout Day": Invalid post type tribe_events

    Total time to import was ~3 minutes. After the "All done. Have fun" message, I verified on both sites the number of pages, posts, media, categories, and that URLs and image links in posts opened properly.

    This is the first time that I have used the WP Importer for migrating site content. On previous occasions, I used a site cloning method which copies site directories and imports with mysqldump.

  3. Andrzej
    Posted 1 year ago #

    But wait there's more. "Failed to import Media" has resurfaced.

    Added a few echo statements inside the WP importer and core include php files to find the failure at filesize != content-length :

    url: http://www.foobar.org/wp-content/uploads/2011/08/googlemapsicon.gif
    processHeaders() header: HTTP/1.1 200 OK
    processHeaders() header: Date: Thu, 20 Mar 2014 15:20:11 GMT
    processHeaders() header: Server: Apache
    processHeaders() header: Last-Modified: Sat, 15 Oct 2011 03:16:25 GMT
    processHeaders() header: Accept-Ranges: bytes
    processHeaders() header: Vary: Accept-Encoding
    processHeaders() header: Content-Encoding: gzip
    processHeaders() header: Content-Length: 1790     <--- BAD
    processHeaders() header: Connection: close
    processHeaders() header: Content-Type: image/gif
    wp_get_http() file written: /home1/destin/public_html/wp-content/uploads/2011/08/googlemapsicon.gif
    filesize: 1767
    content-length: 1790
    filesize != content-length

    The actual source file size is 1767 while the header says it is 1790. I did not dig any deeper to find out why the header[content-length] is off. Perhaps it is the gzip'd size?

    Anyway, one simple fix that works for me is to reset the content-length just before it is tested at wordpress-importer.php

    $headers['content-length'] = $filesize;
    if ( isset( $headers['content-length'] ) && $filesize...

    I suspect a core WP issue because wget shows the correct content-length. Specifically, getting the response header at WP importer vs that of wget:

    # wget -S http://www.foobar.org/wp-content/uploads/2011/08/googlemapsicon.gif
    --2014-03-19 18:37:50--  http://www.foobar.org/wp-content/uploads/2011/08/googlemapsicon.gif
    Resolving www.foobar.org...
    Connecting to www.foobar.org||:80... connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Date: Thu, 20 Mar 2014 00:37:50 GMT
      Server: Apache
      Last-Modified: Sat, 15 Oct 2011 03:16:25 GMT
      Accept-Ranges: bytes
      Content-Length: 1767          <--- OK !
      Vary: Accept-Encoding
      Keep-Alive: timeout=10, max=30
      Connection: Keep-Alive
      Content-Type: image/gif
    Length: 1767 (1.7K) [image/gif]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Importer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.