WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Attachments doesn't work going to single to multisite (6 posts)

  1. PaBLoX
    Member
    Posted 1 year ago #

    I had a couple of websites running different wordpress versions for a while, but it was turning a bit hard.

    So I did some research and tried migrating one website to a fresh 3.5.1 MU install using domain mapping.

    The issue now, it's that the "attachment" system it's not working and thing like gallery or get_the_post_thumbnail() functions aren't working either. Also even when I can see the images on the "media library" when trying to pick a featured image nothing happens, the blue button stays there, instead showing the thumbnail.

    I basically did this:

    1. Exported the database through sql
    2. Check which id my new site had (2)
    3. Search and replace with a text editor wp_ into new_2_
    4. Import the tables into the database
    5. As the "Changing Site Url" codex article said, I changed the url for the uploads post_content inside new_2_posts, from .../uploads/year/month/day to .../uploads/sites/2/year/......

    I found the previously described problem, and then I tried to change the "guid" (also, as the article pointed out).

    I'm really lost right now, because direct links works, and the galleries for example I can only see the links pointing to the new location, clicking the link actually shows the image.

    Any clue on what could be happening?

  2. Yeaaah, that wasn't the right way to do it.

    The RIGHT way is to actually use WordPress's built in export/import tool. Any chance you can undo what you did and start over? It's really a hassle to try what you did, because the upload path moves, but that's not the only thing.

  3. PaBLoX
    Member
    Posted 1 year ago #

    In my experience the export/import tool works, but when it's not too much. It's quite common to get php timeouts, problems moving the images, etc.

    Anyway, I should point that I partially solved the problem:

    It was a bad idea rename wp_ to new_2_ because there are some values that are supposed to be called wp_! Like the ones inside the postmeta table, specifically under the meta_key column. After that magically every attachment works :).

    TL; DR → just rename the table names, not everyhing inside as I did.

  4. It's quite common to get php timeouts, problems moving the images, etc.

    Depends on the size of the site (and the memory on the server). You can always break it out into categories or tags.

    You may still have other issues with what you did, and if so, let us know!

  5. PaBLoX
    Member
    Posted 1 year ago #

    You are right :D, I ran into some other issues like breaking user roles. That's because the roles are serialized inside the wp_options table. So at least the values of that table has to be changed too.[1]

    Since plugins doesn't have a way to call or write inside the database, it could change between plugins, but I honestly doesn't care a lot about that. In the end, most issues about their configuration could be caused by that, using wp_ instead new_prefix or viceversa.

    Until now, I have migrated two websites, and I've been able to keep the content and the users (even keeping their old passwords).

    The only problem I'm running now, it's that I don't know how to keep the "ownership" of the posts, but I guess I need a little bit of research, if you have any clue I'll be glad to know :)

    [1] http://wordpress.org/support/topic/user-role-problem-in-some-subdomain-sites?replies=4

  6. PaBLoX
    Member
    Posted 1 year ago #

    Sorry, can't edit the old post.

    Well, it wasn't hard actually... just needed to map the new ids for the new_prefix_users table with the old ones. In case someone else run into it, it's solved by a simple sql statement (make sure your are in the right database):

    UPDATE table_name SET post_author = REPLACE (
    post_author,
    'old-id',
    'new-id');

    where id is a numeric value.

Topic Closed

This topic has been closed to new replies.

About this Topic