WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Migration Lost Galleries (27 posts)

  1. thebryceisrite08
    Member
    Posted 1 year ago #

    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...

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    They exist in the files. The db points to the files. Download old media files from old site and upload to new.

  3. 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.

  4. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

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

  5. thebryceisrite08
    Member
    Posted 1 year ago #

    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.

  6. thebryceisrite08
    Member
    Posted 1 year ago #

    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.

  7. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

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

  8. thebryceisrite08
    Member
    Posted 1 year ago #

    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.

  9. thebryceisrite08
    Member
    Posted 1 year ago #

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

  10. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    not a single wordpress migration tutorial

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

    http://codex.wordpress.org/Troubleshooting

    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.

  11. thebryceisrite08
    Member
    Posted 1 year ago #

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

    Do I also have to export from wordpress itself?

  12. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

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

  13. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    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

  14. thebryceisrite08
    Member
    Posted 1 year ago #

    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, 'http://www.XXXXXXX.com/?p=2320', 0, 'post', '', 0),

  15. thebryceisrite08
    Member
    Posted 1 year ago #

    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

    http://XXXXX.net/?p=2300

    This shows up in my database...

    http://XXXXX.net/?p=2424

  16. thebryceisrite08
    Member
    Posted 1 year ago #

    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...

  17. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    Did you change them to the new domain before you exported your database?

    I normally use backupbuddy when migrating to a new server or domain and never have any problems

  18. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    Are you using pretty permalinks like /%postname%/?

  19. thebryceisrite08
    Member
    Posted 1 year ago #

    Ok, i'll check that out. I made the changes to the urls after i had exported the database. Basically just opened it up in dreamweaver and replaced XXXXXX.com/blog with XXXXXX.com. Everything works fine except for those posts which used gallery images.

    All i have at this point is the sql file of the old site. So whatever changes i make have to be done to that.

    Theres about 100 posts, and i'm almost just thinking about going through all of them and reuploading images for each.... fun stuff

  20. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    Are the gallery images attached to the posts you uploaded them to?

    Check this in your media library

    Are you using the native gallery or nextgen?

  21. thebryceisrite08
    Member
    Posted 1 year ago #

    They are listed as unnattached... I think i was using the native gallery.

  22. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    I'm pretty sure images should be attached when used in a gallery. Attached to the post you uploaded them to.

    Do they display when you click on the Add Media icon above you editor?

    There should be a number next to Gallery for the number of images uploaded to that page or post

  23. thebryceisrite08
    Member
    Posted 1 year ago #

    Yea, they don't show up. Honestly, this same problem has happened to a lot of people on the boards, and i have poured through all of them. None have been resolved. The image urls are correct, the files are uploaded, but the images won't attach automatically.

  24. WP Sites - Brad Dalton
    Member
    Posted 1 year ago #

    Attach them before you export the database

  25. thebryceisrite08
    Member
    Posted 1 year ago #

    well, yes. They are attached in the old blog when the database is exported.

  26. verset
    Member
    Posted 1 year ago #

    @thebryceisrite08 - did you ever find an answer to this?

    I am developing a site locally and am testing a migration to a live domain. I am running into the same issue. Images are not showing in the gallery despite being 'attached' to the posts. I have uploaded all the images to my server maintaining the same file path structure. I have tried a full sql export as well as a wp xml export.

    It may be worth pointing out that I am not using the default WP uploads folder. I am using an override in wp-config.php - define( 'UPLOADS', ''.'jewelry' ); However, I have set this on both the local environment as well as live.

    When I go into the wordpress media library, nothing appears.

  27. JasonSizzle
    Member
    Posted 1 year ago #

    Sometimes, you need to go into wp_content/uploads and copy over the folders... they should be ... 2011, 2012, 2013

    All migrations aren't perfect and sometimes it takes being resourceful and exploring all options.

    I have had these troubles as well, it does stink to have to rebuild a gallery, but that's what happens in the world of web.

Topic Closed

This topic has been closed to new replies.

About this Topic