Support » Fixing WordPress » WordPress Migration Lost Galleries

  • I recently migrated my site to a new domain. I exported a sql database of blog posts from the old site and imported them to the new site through phpmyadmin. Now, the posts are all showing up but the images for each post are not.

    On my server all the images are stored in /wp-content/uploads, however they don’t exist on the media page. I don’t know how to move those all into the media section or if i even need to since they are on the server…

    I checked my sql database file, to change the urls and noticed that the galleries don’t show urls to the images but rather say [gallery-link =”file”] or something along those lines. I have no idea what that means or how the database would even link to the gallery without some sort of descriptor.

    So, bottom line is, i got my million posts migrated over to the new site, but none of the images. Changed all the urls that needed to be changed, but galleries are not working…

Viewing 15 replies - 1 through 15 (of 26 total)
  • They exist in the files. The db points to the files. Download old media files from old site and upload to new.

    Chris Olbekson


    Level 12 Bug Squasher & Forum Moderator

    The gallery shortcode uses the wp_post_meta table in the database to get the images attached to the post. When an image is attached to the post using the media uploader 4 things happen.

    1. An attachment post_type entry is created in the wp_posts table and the ID of the actual post is assigned to the post_parent column.

    2. A post_meta entry is made using the post id of the attachment with the meta_key _wp_attached_file. The value contains the img url relative to directory set in media options ( usually wp-content/uploads ).

    3. Another post_meta entry is made using the post id of the attachment with the meta_key _wp_attachment_metadata. This contains a serialized array containing the file src, width, and height of each image size along with camera exif metadata.

    4. A post_meta entry using the POST ID OF THE ACTUAL POST with the meta_key _thumbnail_id which references the post id of the attachment.

    You stated that “I exported a sql database of blog posts from the old site and imported them to the new site through phpmyadmin” Did you export and import the entire database or just the blog posts? If it was just the blog posts you will also need to export and import the wp_post_meta table and it would probably be a good idea to also import the wp_terms, wp_term_taxonomy, and wp_term_relationship tables as well.

    It may be more helpful to to point out the obvious?

    I exported the entire database for the blog, changed the urls to point to the new domain, and uploaded all of the content to the new site.

    Some images work, but the galleries do not.

    Yea, i get the basics of it. And for the most part, everything worked fine. It was just the gallery images do not display, and my images which are uploaded to the server do not show up in the media section of the admin page.

    You exported only the images in the library, upload the rest, issue over…this issue is both well known and understood by most.

    Ok, thanks for your help, but no need to be condescending.

    So, in addition to uploading all the images to the server, I must also import them into the Media Section of wordpress? If so, i haven’t done that.

    additionally, there is not a single wordpress migration tutorial that asks you to do that.

    not a single wordpress migration tutorial

    Condescending? Your desire is to learn? I wish you the best.

    If you post the URL (per forum rules for best support), I believe it likely you have post or page embedded images and they are not in the Media Library (but ARE files that can be uploaded and that will fix the issue – takes a few minutes)
    Please share this as a tutorial.

    Ok. So I have exported my database in its entirety using phpmyadmin.

    Do I also have to export from wordpress itself?

    You need to download any images linked at old site and upload to new site with same folder structure.

    Brad Dalton


    You should change the site address in WordPress general settings before you export the database.

    WordPress Address (URL)
    Site Address (URL)

    Otherwise, you’ll need to use the search and replace or velvet blues plugin to change the url’s to your images

    So this is the problem here. I copied from my database, a post entry. You’ll notice that in place of a path to the image, is something that says [gallery link="file"]. These posts don’t show the image.

    Example not working:

    (2320, 1, ‘2012-08-21 03:12:00’, ‘2012-08-21 03:12:00’, ‘[gallery link="file" order="DESC"]\r\n\r\nYesterday was the one-day set of Method”s two story, 1,400 square foot custom home located on Bainbridge Island. The three bedroom, two bath home designed by Group Architect utilizes sustainable systems and construction techniques, including Henry Blueskin wrap with a Method-designed pressure treated plywood rain screen, a Daikin altherma air to water heat pump, electric heated floors, Taylor metal roofing, prewiring for solar power, and low VOC paints, finishes, and adhesives.’, ‘Custom Bainbridge Prefab Set’, ”, ‘publish’, ‘open’, ‘open’, ”, ‘custom-bainbridge-prefab-set’, ”, ”, ‘2012-08-21 04:25:19’, ‘2012-08-21 04:25:19’, ”, 0, ‘’, 0, ‘post’, ”, 0),

    one thing i noticed is that the permalink for some posts in the database are different from the permalink shown in the edit page area.

    This shows up in wordpress

    This shows up in my database…

    changing those to match did nothing…. at a loss here. Pretty sure its the fact that some of these posts have a [gallery link="file'] tag and thus do not work…

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘WordPress Migration Lost Galleries’ is closed to new replies.