1

I'm trying to get my old posts from a WP install that was in a sub-directory on my site, into a new Multisite install on a new host.

The new install is doing what it should. the problem is the posts are in a database with a different table prefix. i'll admit that i didn't think it would be this difficult.

but i need it to either pull from the correct prefix wed_ not wp_2_

or

replace all the data in wp_2_ with the data from wed_

thanks.

ANSWER

after some poking around some mysql websites, i found that find/replace isn't really straight forward.

lets assume that the database table prefixes in question are new_ and old_ and that i want to replace new with old

myphpadmin has an option of change prefix,

here are the steps i did to correct my issue.

  1. export the sql databases to my desktop as a backup.
  2. change new_ to bak_new_
  3. change old_ to new_
    • since nothing else has changed wordpress is still pulling from the new_ tables, but has old_'s data.
    • this works! but no images.
  4. export the new new_ to the desktop.
  5. open in a text editor and find/replace all the old urls that should point to your images to your new url.
    • when using multisite installs the upload folder has new subfolders.
      • new path: http://example.com/wedding/wp-content/uploads/sites/2/2014/06/program03.jpg
      • old path: http://example.com/wedding/wp-content/uploads/2014/06/program03.jpg
    • note the added sites/2 in the new path.
    • save

In myphpadmin

  1. select all the new_ tables and drop them.
    • this deletes them, after giving a warning that asks if you really want to do this. click yes.
  2. import the file with the replaced urls with the same new_ prefix.

done

upload all the images to the new path of the server and verify that everything works. then delete the bak_new_ tables since they're useless now. now all the old data from my old/incorrectly install site works on the new multisite install.

  • HUZZAH I figured it out after some experimenting and intentionally breaking my site. I'll post my answer soon for future reference. – Bchavez.gd Jul 24 '14 at 3:02
  • Easiest method for future reference... export the old site to WP format and import as a site on the new multi-site install. – jdm2112 Jul 24 '14 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.