Import images from old WordPress site into new site

Question

I have exported both tables from old wordpress site of which gallery images i want to import into new wordpress site.

After export, i follow following steps:

–> In the wp_posts.sql file I did the following:

  1. First I change all the INSERT INTO sentences to INSERT IGNORE INTO in case duplicate keys exists It don’t break them

  2. I modified all image urls to match new domain (not always needed, depending where you are importing from)

  3. I removed all unnecessary SQL code such as ALTER TABLE and INSERT TABLE and just left the INSERT INTO SENTENCES
    Ziped the file and imported into new site db with phpmyadmin

    –> In the wp_postmeta.sql file I did the following:

    1. I removed all the unnecessary SQL code such as ALTER TABLE and INSERT TABLE and just left the INSERT INTO SENTENCES
    2. I changed all the INSERT INTO wp_postmeta ( meta_id, post_id, meta_key, meta_value) VALUES to INSERT INTO wp_postmeta ( post_id, meta_key, meta_value) VALUES . Basically Im removing meta_id because I want to insert all the postmeta at the end of the table and use the auto increment
    3. I did a regex search and replace to remove all ID from values. I used ( ([0-9]+), and replaced with just (
      Zipped file and imported to new site

–>The last step is to copy the image files into the wp-content/uploads/

–>Before import these tables into new wordpress database, i removed Create Table code from both files to avoid exiting table error.
–> Both tables successfully imported, but in media folder images have not reflected. It is only showing demo images of theme installed and activated.

Kindly provide solution in this case.

Thanks

0
, , , , Ankush Kumar 3 years 2019-12-01T11:40:36-05:00 0 Answers 76 views 0

Leave an answer

Browse
Browse