trenchant

about what I know and what interests me

WordPress attachment import/export issue – workaround

I exported the all my wordpress posts here using the Tools – export option. I later tried to import all the posts to my new domain (I shall announce soon). The import was only half successful. Pictures that form an integral part of my posts have been skipped.

And in fact there were errors like:

Remote file error: Remote server did not respond.

and

Remote file error: Remote file is incorrect size.

I then tried to debug the import mechanism on  wordpress-2.8.6. I found that there was not much of a problem with it.  The problem was actually with the export mechanism.

Here are my findings:

Post attachments are mentioned in the XML within the <wp:attachment_url> tag. The URL for one such picture attachment was something like:

url1

When I tried to put this URL on the web-browser, it redirected to:

url2

While the latter URL seems to be more direct form of accessing the attachments, the problem could be with resolving the relative URLs in wp_get_attachment_url() of wp-includes/post.php

The work around for now would be to perform a replace-all for files.wordpress.com with files.wordpress.com in the exported XML file. I have made sure that only the <wp:attachment_url> tag has such entries.

Hope this helps.

4 Responses to “WordPress attachment import/export issue – workaround”

  1. […] See the rest here: WordPress attachment import/export issue – workaround « My 1st Blog […]

  2. Iboong says:

    Dear Author bharathreddyt.in !
    In my opinion you commit an error. I can defend the position. Write to me in PM, we will talk.

  3. I want to quote your post in my blog. It can?
    And you et an account on Twitter?

Please share your thoughts