admin管理员组

文章数量:1302383

I am redeveloping a client's site and, for a number of reasons, in the process changing hosts. I'm developing it on the new host and to get the site orgainised I have attempted to import all the pages from the old site using the WordPress export/import plugins.

During the import I checked the "import images" checkbox but it doesn't seem to have worked. All the images in the pages are being loaded from the old site and the media library in the new site is empty. Here are the URLs for reference:

new site:

old site:

I am redeveloping a client's site and, for a number of reasons, in the process changing hosts. I'm developing it on the new host and to get the site orgainised I have attempted to import all the pages from the old site using the WordPress export/import plugins.

During the import I checked the "import images" checkbox but it doesn't seem to have worked. All the images in the pages are being loaded from the old site and the media library in the new site is empty. Here are the URLs for reference:

new site: http://sergedenim.es

old site: http://sergedenimes

Share Improve this question edited Nov 14, 2012 at 12:57 Chip Bennett 55.1k8 gold badges90 silver badges170 bronze badges asked Nov 14, 2012 at 9:24 harrygharryg 7635 gold badges11 silver badges23 bronze badges 1
  • What WP version are you running? And the Importer plugin version? I suppose it'll be the latest, but just in case... Are you trying the import just after having installed the new site or do you already have plugins and new theme activated? Also, what does the new server error_log shows? – brasofilo Commented Nov 14, 2012 at 11:30
Add a comment  | 

4 Answers 4

Reset to default 5

Although Chip's method may work for some it did not for me. I did get it working however this way:

  1. Do the normal export of pages and posts and import them to your new blog (having deleted the original pages and posts)
  2. Download the wp-content/uploads folder via ftp from your old site and upload it to your new site, replacing what's there.
  3. Go into phpmyadmin on the old site and use an SQL query to select all posts that have post type = "attachment" in the wp_posts table. Export the results of this query and save on your PC.
  4. Export the wp_terms table from your old site.
  5. Import both the mySQL exports from your old site into your new site via phpmyadmin.
  6. Use the "search and replace" plugin to replace all occurrences of your old domain in your database with your new domain.

If all goes well you should have all your attachments in your new site along with all thumbnails stored and referenced correctly.

Did you tried to use plugin that updates urls after changing url of medialibrary?

Velvet Blues Update URLs

  1. Ensure both domains are active
  2. Ensure the same version of WordPress is installed on both domains
  3. Ensure the Same Theme is active on both domains
  4. Ensure the Same Plugins are active on both domains
  5. Ensure that the images are hosted and attached in the old domain.
  6. Delete all default/dummy post data from the new domain (Test Post, About page, etc.)
  7. Export all content from the old domain
  8. Import the resulting XML file to the new domain
  9. Ensure download and attach media is enabled/checked
  10. Note any errors printed during the import process

A client wanted to start a new wp with all their old wp´s images, here is how I did it:

  1. copy the uploads folder to the new directory
  2. On the old site make an sql dump only containing the attachments, eg:

mysqldump --opt --user="user" -p database_name wp_posts --where="post_type='attachment'" > exported_attachments.sql

  1. Open the exported_attachments.sql in text-editor and replace all occurences of the old protocoll+domain to the new, eg. http://site-old -> https://site-new

  2. Import the sql into the the new database

  3. done :)

本文标签: media libraryImport Images from one selfhosted WordPress install to another