Methods to prevent data loss during website migration, including posts, comments, and orders

The most frightening thing when migrating a website to a new server is not just a momentary screen glitch. It’s the possibility that posts, comments, and recent orders that existed on the old site will disappear on the new site.

This problem often occurs when fewer files are copied. It happens because new records that are created on the original site are not copied to the replica. So, how can data gaps be prevented?

Reasons why posts and orders disappear even after copying.

A WordPress site contains two main types of data. These are the database, which contains posts, pages, comments, and settings, and the files, which include themes, plugins, and images.

According to the official WordPress documentation, database backups include posts, pages, comments, and settings, but do not include themes, plugins, or uploaded files. Both must be backed up to ensure that the site’s appearance and content are preserved.

The database can be exported using the WP-CLI database export function and imported using the import function on a new server. The problem is that the original site continues to operate even after the export process has begun.

Let’s assume that the database was copied at 2:00 PM. If a new post is uploaded at 2:10 PM, a comment is added at 2:20 PM, and an order is placed at 2:30 PM, then these records will not be included in the first copy.

A photocopy is a photograph taken at that moment.

Why aren’t the currently operating websites simply performing file copies?

Websites with active users continue to conduct business even during migration. In particular, online shopping malls will not process orders until the data migration is complete. Customers read the server migration schedule and do not proceed with payment until then.

The official migration documentation for WooCommerce instructs users to migrate users, products, product reviews, coupons, orders, and subscriptions in a specific sequence for this very reason. It is not enough to simply migrate a single order; the order must be correctly associated with the correct user and the correct product.

Data is not only generated in the administrator interface. The WordPress REST API supports remote requests for creating and modifying posts, so external services or integrated features can also create new records.

The reservation process and the payment functions can operate independently. Therefore, migrating the server is not a simple matter of packing up belongings once.

This involves continuously transferring records from the original source to a new server.

The safest approach is to stop writing at the last possible moment.

For a small blog, the solution is straightforward. First, create a complete backup. Then, temporarily stop writing posts and comments, and copy the database again just before the final conversion.

WordPress has an official feature, accessible through WP-CLI, to enable maintenance mode. In this mode, you can export the final database and import it into a new server, then redirect traffic to the new site.

Do not rely on the first copy and conclude the process.

The first copy is the framework of the new house, while the last copy represents the actual record accumulated until just before the move.

Shopping malls that are receiving a continuous stream of orders face a range of options.

  • If the system has features for tracking and synchronizing changes, and provides logs, then it is possible to review the synchronization process while it is running.
  • If such a function is unavailable, pause the payment briefly and proceed with the final copy.

Even when an uninterrupted transfer is possible, conditions apply.

Some older WooCommerce documentation describes a method of migrating products, customers, and orders by dividing them into background tasks and continuously reflecting changes made during operation. There is also a method for automatically synchronizing orders, customers, and products between the source and destination stores.

However, this is not a simple “copy” button. It requires HTTPS on the target site, and the user must have permission to read and write to the REST API. WP-Cron or Action Scheduler must be functioning correctly, and the versions of WooCommerce being used must be compatible.

If even one condition is not met, the synchronization may stop. Even if the screen shows that the new site is functioning normally, a silent error may occur where some orders are not processed correctly.

Automatic synchronization requires additional verification steps.

You must check the logs to confirm that all of the changes have actually arrived. The word “automatic” does not mean that verification is not required.

The most common points of failure when transferring data directly are:

When performing the task directly, it is easy to miss the difference between the initial copy and the final copy. The files are located on a new server, while recent posts and comments remain on the old server.

It is easy to assume that simply enabling maintenance mode will stop all data writing. However, it is necessary to check, depending on the site’s configuration, whether components such as payment plugins, external forms, REST APIs, and scheduled tasks are actually writing data independently.

It is also dangerous to assume that you only need to merge the order CSV files later. Orders are related to users, products, coupons, and product reviews. If you only add the order information, the connections to customers and products may be broken.

There are limitations even when comparing all records by human eyes. Even if the number of posts matches, a recently modified post might be missing. Similarly, even if the number of orders matches, a different order might be duplicated.

The more directly you do something, the more important verification is compared to copying.

Therefore, it is necessary to check the number of posts, the number of comments, the most recent modification date, and the connections between orders, customers, and products, comparing the original site with the new site on a per-item basis. If there are external integrations or scheduled tasks, the records generated through those processes must also be checked separately.

If you need to determine what content to migrate and verify the results, you can use LUX Content Migration. You can select posts, pages, categories, comments, authors, custom fields, and media, export them as files, and import them into a new site, categorized accordingly.

Before importing, you can use the Preview function to check the new posts and comments that will be created, as well as the number of required images. If you need to revert the newly created posts after a specific category import, you can use the “Roll back” feature for the completed category.

Determine the appropriate configuration based on the size of the website.

If the website is small and only generates posts and comments, perform the task during a period of low traffic. Enable maintenance mode, which will also stop comment posting, form submissions, and reservation processes, and then copy the entire database.

After opening the new site, compare the number of posts, recent comments, and recent modification dates with the original site. If the site receives posts through a REST API or external integration, you must also verify the corresponding paths.

If you are using WooCommerce and encountering orders, attempt a seamless migration only if the system has a pre-copy function and logs that allow synchronization of orders, customers, and products. If you cannot verify the synchronization status or import errors, it is safer to temporarily suspend payments.

Before the upgrade, it is necessary to back up both the database and the files. WP-CLI supports not only database export and import, but also post and comment management, as well as enabling maintenance mode.

If writing is disabled and synchronization is not prepared, postpone the switchover date.

A brief delay may be inconvenient, but orders and comments that have disappeared will not return, no matter how long you wait.

Frequently Asked Questions.

Q. Does a website that only contains posts and comments also need to be put into maintenance mode?

A. It is safer to stop the writing process at the moment when the final database is being copied. It is also necessary to check functions that create records in separate paths, such as comments, forms, and scheduled tasks.

Q. What criteria should be used to select the online shopping mall to which orders are directed?

A. If there are synchronization features and logs that track changes, you can consider performing a live migration. If this is not possible, it is safer to temporarily suspend payments and perform a final copy of all orders, customers, and products.

Q. Can this problem be easily solved using a tool? What kind of tool should be used?

A. A management tool is available that supports database export/import and maintenance mode. Before using the tool, verify that the shopping mall supports order, customer, and product synchronization, as well as error logs, permissions, and scheduled tasks.

WordPress-related links

https://store.luxdigest.com
https://wpcm.luxdigest.com
https://sohoseo.luxdigest.com