WordPress - How to migrate media (attachment, gallery) properly (single or multisite)
One of the big problem when you migrate your WordPress blog to another server with a new domain name is the media gallery. What happened to me was even though I had already moved all the photos (media) to the new location but nothing showed up in the Media dashboard and all the gallery shortcode in posts were broken. I figured out earlier today that I need to update the media links or attachments attribute when I importing the old data (exported WXR file). Here is the step-by-step detail: (I'm doing this for my multisite WordPress) 1. In the old WordPress: Export old blog data (Tools > Export > select All Content > press Download Export File). You will have a xml file. 2. Copy over all the photos from the old WordPress to the new one. For example: Old: /var/www/oldblog/wp-content/blogs.dir/777/ New: /var/www/newblog/wp-content/uploads/sites/777/ 3. Open the export file using a text editor. Search and replace the old media path with the new one. For example: Ol...