Here is the situation: some friends had an old web site with wordpress running on it, and lost the domain name and hosting account through some shenanigans we won’t discuss here. I have a full backup of their site, including a wordpress export file in XML.
I can easily create a completely new wordpress installation on their new server, using the export file to import all their posts into the database.
The problem is here: I can’t use the importer to pull over the images and attachments using that XML file, because the links are incorrectly pointing to the now non-existant old site. I have the images and attachments, but now I’m wondering how can I bulk upload them into the new database’s media library and maintain, or update, the links to them properly?
Scanning the wordpress support site and looking through the plugins list yields far too many hits that have nothing to do with what I am trying to accomplish.
I’ve tried modifying the export XML file to tell it to pull files from a local drive instead of the old host, by modifying attachment posts’ <wp:attachment_url>
entry, but this did not work. If someone knows what particular field the wordpress-importer is using, that would be quite a help, I think.
This will work only if , like you stated in your question – you have the
FULL BACKUP
of the site ( files AND database )1 – FTP Put all the
original
wp folder structure from OLD site into NEW server as – is .2 – login to phpmyadmin and import the OLD database .
3 – run SQL like so :
Later , Just to verify , go to the
wp_options
( orprefix_options
) table and search forhome_url
andblog_url
options – and see if they are accordingly change ( this depends on DB version )If all is ok and done correctly – you now can log in to your new domain..
BTW – If you have files and DB on local machine , you can run the changes, export and import to the DB already changed .. ( which is how I usually do it almost on a daily basis – a bit more time but fool proof )
If you do all the above correctly , and you did have the
ORIGINAL
DB and files exactly from before – you will have a new working copy on the new domain .Basically, if you do that correctly , there is no need to “import” any images . you will be performing a simple move of domain for the whole site, including plugins, content, images, settings, themes and what not ..
Note on upgrades / version: when I wrote “original” wp folder structure I meant just that . even if it an old wp version and old plugins / themes – first do those steps above , and only then run an upgrade . Do not put a new wp version unless you know the old one is db compatible …