将您当前的WordPress博客迁移到WordPress多站点博客

Last month, I wrote and presented a video about how to host multiple sites in WordPress 3.0. This raised the question of what to do if you already have multiple WordPress sites and would like to bring them together to leverage the power of the WordPress multisite feature.

上个月,我撰写并演示了有关如何在WordPress 3.0中托管多个网站的视频 。 这就提出了一个问题,如果您已经有多个WordPress网站,并且希望将它们组合在一起以利用WordPress多站点功能的强大功能,该怎么办。

Until recently, migrating all your blogs to a single multisite blog was a massive task because of the need to resolve conflicting IDs across different tables. Fortunately, newer WordPress versions have built-in functions to make life a bit easier for all of us.

直到最近,由于需要解决不同表之间冲突的ID,将所有博客迁移到单个多站点博客是一项艰巨的任务。 幸运的是,较新的WordPress版本具有内置功能,使我们所有人的生活都更加轻松。

You’ll find the official WordPress multisite migration documentation here, but I’m going to give you a summary of the process here, plus another video on the topic. Here’s the video:

您可以在此处找到官方的WordPress多站点迁移文档,但在这里我将为您提供有关该过程的摘要,以及有关该主题的另一个视频。 这是视频:

In this summary, I will use “multisite” to refer to the master WordPress blog, “singlesite” to refer to the single WordPress blog that you want to migrate over and “newsite” as WordPress installation that acts as a placeholder site in a subdirectory under “multisite”. The content from the “singlesite” will need to sit in “newsite” before domain migration occurs.

在此摘要中,我将使用“多站点”来指代主WordPress博客,使用“单站点”来指代您要迁移的单个WordPress博客,并将“新站点”指代为WordPress安装的子站点中的WordPress站点。在“多站点”下。 域迁移发生之前,“单个站点”中的内容将需要放在“新站点”中。

The first thing to do is make some preparations.

首先要做的是做一些准备。

Make sure you have the latest version of WordPress installed: we’re up to version 3.1 now. This is important for consistency between installations and also to ensure you have access to the multisite feature. Upgrade WordPress if necessary and ensure the multisite feature is enabled. Check the previous video for details.

确保您已安装最新版本的WordPress:我们现在的版本为3.1。 这对于确保安装之间的一致性以及确保您可以访问多站点功能非常重要。 如有必要,请升级WordPress,并确保已启用多站点功能。 有关详细信息,请查看上一个视频

Back up all databases for both multisite and singlesite.

备份多站点和单站点的所有数据库。

Do not activate domain mapping for newsite yet.

暂时不要为新站点激活域映射。

This is a good time to do a bit of housekeeping and remove all old spam comments, expired users and unwanted posts on singlesite. You will reduce unwanted content and make your life a little easier later on.

现在是进行一些整理工作并删除所有旧垃圾邮件评论,过期用户和单个站点上不需要的帖子的好时机。 您将减少不需要的内容,并在以后使您的生活更轻松一些。

Copy the theme and plugins from singlesite to multisite. How you achieve this depends on how your sites are hosted. You may need to use cPanel or similar, or stand alone FTP.

将主题和插件从单站点复制到多站点。 如何实现这一点取决于网站的托管方式。 您可能需要使用cPanel或类似的产品,或者单独使用FTP。

The next step is to export the content of singlesite to a downloadable file. In the singlesite WordPress admin panel under Tools in the left sidebar, click on Export. Click on the Download Export File button to export the content of the site to an xml file.

下一步是将单站点的内容导出到可下载的文件。 在左侧站点工具栏中的WordPress单站点管理面板中,点击导出 。 单击下载导出文件按钮以将站点内容导出到xml文件。

Switch your attention to the newsite WordPress installation. To import the singlesite xml file we have just exported, we need to install a plugin. Click on Add New under Plugins in the left sidebar of the admin panel and search for the term “WordPress Importer”. Follow the instructions to install that specific plugin.

将您的注意力转移到新站点WordPress安装上。 要导入我们刚刚导出的单站点xml文件,我们需要安装一个插件。 单击管理面板左侧栏中的“ 插件 下的“ 添加新项”,然后搜索“ WordPress导入程序”一词。 按照说明安装该特定插件。

Then go to Tools / Import, click on WordPress and upload the singlesite export xml file. Proceed with the import only up to the Assign Authors page.

然后转到“ 工具 / 导入” ,单击WordPress并上传singlesite导出xml文件。 仅继续进行导入,直到“ 分配作者”页面。

At this point, you’re given the option to map the authors from singlesite to newsite. This is the most challenging part of the process because WordPress does not allow you to have duplicated authors across different sites in your multisite, so you need a way to identify and resolve the duplicate authors.

此时,您可以选择将作者从单站点映射到新站点。 这是该过程中最具挑战性的部分,因为WordPress不允许您在多站点中的不同站点上拥有重复的作者,因此您需要一种方法来识别和解决重复的作者。

To do this, you can compare author usernames and email addresses.

为此,您可以比较作者的用户名和电子邮件地址。

Go to phpMyAdmin for the singlesite database. Duplicate the wp_users table, call it wp_users_tmp and then export this table. Then switch to the multisite database and import wp_users_tmp.

转到phpMyAdmin获取单站点数据库。 复制wp_users表,将其wp_users_tm p,然后导出该表。 然后切换到多站点数据库并导入wp_users_tmp

To compare the wp_users table from both databases, run this query on the multisite database to give us a list of all email duplicates.

要比较两个数据库中的wp_user表,请在多站点数据库上运行此查询,以向我们提供所有电子邮件重复项的列表。

SELECT t.user_login as singlesite_user, w.user_login as multisite_user, w.user_email
FROM wp_users w, wp_users_tmp t WHERE w.user_email = t.user_email

Now run this query to check for any username duplicates.

现在运行此查询以检查是否有用户名重复。

SELECT t.user_login as singlesite_user, w.user_login as multisite_user, w.user_email
FROM wp_users w, wp_users_tmp t
WHERE w.user_login = t.user_login and w.user_email != t.user_email

Back on the Assign Author page in the multisite import process, append “_singlesite” or another unique identifier to the existing singlesite username for any case where a user is duplicated.

返回多站点导入过程中的“ 分配作者”页面,对于任何有重复用户的情况,将“ _singlesite”或另一个唯一标识符附加到现有的单站点用户名中。

Check the Download and import file attachments checkbox and click Submit.

选中下载和导入文件附件复选框,然后单击提交

Since all users now have unique names, you can compare them against the profiles you have in singlesite. Now, you can manually enter their profile details in the users section.

由于所有用户现在都有唯一的名称,因此您可以将它们与单个站点中的配置文件进行比较。 现在,您可以在“用户”部分中手动输入其个人资料详细信息。

Re-activate all the plugins and re-setup the widgets in newsite. You can also configure the theme under Superadmin / Sites.

重新激活所有插件,然后在newsite中重新设置小部件。 您还可以在Superadmin / 站点下配置主题。

Point your browser to http://multisite.something/newsite/and check that newsite now holds the content of the singlesite.

将浏览器指向http://multisite.something/newsite/,并检查newsite现在是否包含该单站点的内容。

Change the IP address of the singlesite domain to point to your multisite host.

更改单站点域的IP地址以指向您的多站点主机。

Add the singlesite domain as the primary domain under Superadmin / Domains.

Superadmin / Domains下,将 站点域添加为主域。

This migration process is much more complicated than the previous process and I suggest you watch both the first and this latest video to thoroughly familiarize yourself with the process before you tackle it.

此迁移过程比以前的过程复杂得多,我建议您同时观看第一个这个最新视频,以便在开始之前全面熟悉该过程。

I hope this will help you if you are thinking of migrating your WordPress blog. That’s it for now.

如果您正在考虑迁移WordPress博客,希望对您有所帮助。 现在就这样。

翻译自: https://www.sitepoint.com/migrating-your-current-wordpress-blog-to-a-wordpress-multisite-blog/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值