1

I have a WordPress multisite installation, and I need to remove the multisite, and keeps just the site ID 5 (domain.com/br) in the main address (domain.com).

So I follow this tutorial to remove WordPress multisite installation: http://premium.wpmudev.org/blog/uninstall-multisite/. After that I dropped wp tables post, terms, term_taxonomy etc, and changed the tables wp_5_ to wp_. My site became extremely slow to open pages, his aesthetic was greatly affected, images did not load, so I was informed about the serialized data in the database, and that I should not change the database manually.

I do not intend to migrate the multisite to NGINX, so I think I have 2 options:

Do a stand alone installation (domain.com/br in domain.com, and after redirect .com to .com/br), and stay with a single website. change the database tables from site ID 5 to the main site tables database (I mean keeps just one database working perfectly), and migrate a single website.

Which do you recommend, and can you provide references on how to do this?

p.s.: I'm disregarding the option of buying a plugin to do this, and learning to do at hand.

1

You can try a couple of things. WordPress has a built-in Importer/Exporter you can find under the Tools menu:

WordPress Admin "Tools" menu showing Import and Export features

The tool is a bit hit or miss, your mileage may vary.

Alternatively, you can do the following:

First, take backups of everything!!

It sounds like you already have, but do it again, just in case.

  1. Export only the wp_5_ tables from your current database to a SQL file.
  2. Next, create a fresh new WordPress single site. Don't add any content or anything, just set it up.
  3. Import the SQL file from step 1. into your single site database. Now, you should have both wp_ and wp_5_ tables.
  4. You have a couple of options now:
    • In your wp-config.php, change this line $table_prefix = 'wp_'; to $table_prefix = 'wp_5_';
    • OR: Run a query like this for EVERY table you want to migrate:
INSERT INTO wp_posts SELECT * FROM wp_5_posts;
-- ... etc, so for terms you would do
INSERT INTO wp_terms SELECT * FROM wp_5_terms;
  • In your wp-config.php, change this line $table_prefix = 'wp_'; to $table_prefix = 'wp_5_'; In this case, I need some tables from 'wp_', like users. OR: Run a query like this for EVERY table you want to migrate: And about the images? I do not know in which folder I should export the images, and I do not know if I should do this with a predefined rule, for example, if the images are organized according to the upload date of them. – paivadaniel Apr 2 at 13:45
  • @paivadaniel On the $table_prefix part, you are correct that you would need to rename wp_users and wp_usermeta, which kind of defats the point (although it's only two renames). The INSERT INTO ... SELECT will not touch serialization at all. Images: I can't help much there, unfortunately. It depends on what your image paths look like, but all of the site's images you're migrating are in wp-content/uploads/site/5/ (I believe, or something similar). You may be able to copy the images from /5/ to wp-content/uploads, but I'm not sure that will work. – phatskat Apr 4 at 6:12
0

In your wp-config.php, change this line $table_prefix = 'wp_'; to $table_prefix = 'wp_5_';

In this case, I need some tables from 'wp_', like users. So, what do you suggest? For example, create new 'wp_5_' tables to users, and them migrate the database with the second option that you gave me. I think this should work.

OR: Run a query like this for EVERY table you want to migrate: INSERT INTO wp_posts SELECT * FROM wp_5_posts;

Will not I have problems with date serialization doing this?

I know that the wp search-replace command does not generate this kind of problem, I was thinking of using it for this.

And about the images?

I do not know in which folder of wp-content I should export the images, and I do not know if I should do this with a predefined rule, for example, if the images are organized according to the upload date of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.