How to export fields and links when migrating content from WordPress to an independent CMS
Migrate WordPress content to an independent CMS, how to handle exported fields and old links? The failure of migration is usually not that the articles are lost, but rather three types of details: field structure not implemented, categories and custom fields become a bunch of empty values; relationships are lost, categories and tags correspond to the new system by manual补充;old addresses are not received, external link incoming pages all fall to the homepage. Follow the five steps to cover these three areas: list objects, map content model, define address rules and redirect table, batch import, and verify after import.
Step 0: List the objects to be migrated first.
Before exporting, list the objects first. The WordPress export file includes posts, pages, custom post types, comments, custom fields, categories, tags, custom category taxonomies, and users. The scope can be narrowed down by category, author, date, and status.
Decide the destination for each item on this list: posts go into the document model, pages go into single pages, categories go into columns, tags go into the tag system, custom fields need to match the field definitions, comments should be checked to see if the new system retains the history. Whether users are migrated depends on whether the new site continues to use the member relationship.
When listing objects, note the quantity at the same time. The number of entries exported should match the number of entries on the source site. If they do not match, check the cause in step 3 instead of waiting for readers to discover it after going live.
Step 1: Map custom fields to content models
This step is where the real cost of maintenance after migration is determined. Custom fields on the source site are loose key-value pairs, and different fields may be present in different columns of the same type of article, supported by template conditions.
The new system side needs to solidify these fields using the content model first: what kind of content has which fields, which are required, and which participate in list sorting and filtering. AnQiCMS supports custom content models and custom fields, the method is to build a model according to the content type first, and then correspond the source site fields one by one; if a field cannot be found, first judge whether it is display information or a filtering basis, display information can be left directly in the text, and the filtering basis must be built into a field, otherwise it cannot be used later.
| Source site object | Migration destination | Common processing mistakes |
|---|---|---|
| Article | Official documents under the document model | Status is not distinguished, draft is treated as official released. |
| Page | single page | Treated as a regular article, the navigation structure is messed up |
| Category | Column | Hierarchical flattening, second-level categories become同级 |
| Tag | Label System | Mixed with categories, keywords are duplicated |
| Custom field | Content model field | Unbuilt field, information only remains in the main text |
| Comment | Comment data | Discarded directly, historical interactions are zeroed out |
| a user | Users and groups | All fall into the same role |
Step 2: Determine the new site address rules and redirect table
The address rules need to be determined before import because the links need to be written into the link field at the time of import. The new site's pseudo-static rules determine the form in which the articles are presented externally, commonly by category + date + identifier, or directly by identifier. Once the rules are set, the old site addresses are written into a mapping table category by category: the old address of the article corresponds to the new address, the category and tag archives are handled separately, and the parameterized addresses are uniformly convergent to the standardized form.
Write the redirect table one-to-one, use permanent redirection for all, and do not redirect the entire site to the home page. This step is a shortcut, and all the link relationships before will be zero.
Step 3: Batch Import and Sampling
There are three ways to batch import: compressed packages, spreadsheet files, and interface methods. AnQiCMS supports batch importing documents with ZIP compressed packages and Excel spreadsheet files, and also provides the /api/import/archive import interface. You can also check if the title already exists, so there's no need to worry about duplicate data falling into the database when running it again.
The principle of batching is to average by risk rather than by quantity: first run a small column trial, check the field landing situation, internal links in the text, image references, and publishing time; proceed in batches by column after confirming that there are no errors. Field structure issues can be seen at a glance in small batches, and if changes are made after full import, the process needs to be run again.
Step 4: Three types of verification after migration
The first type is quantity verification: the number of exported entries, the number of successful imports, and the number of actual visible entries should match, and the difference should be explainable (usually draft, pending review, and trash content). The second type is link verification: check whether the internal links in the text have already pointed to the new address, whether the category page and tag page can be opened normally, and whether the old address returns a permanent redirect. The third type is list verification: the sitemap only outputs formal documents, the new address is followed by link push submission once, and the object actively pushed is the new address rather than the old address.
Do not move the old content together. Documents that have been moved to the recycling bin should be restored and decided on individually before being moved back, as batch import should not bring abandoned content back to the new site.
Common questions
Should the images in the exported file be moved separately? Yes. The export includes image addresses, not the files themselves. The materials should be moved together and the references rewritten; otherwise, the new site will go live with all external link images.
Is it worth moving the comment history? It depends on whether the site relies on interaction to retain users. If it is to be moved, the comment status field in the new system should be confirmed to correspond, and do not bring in deleted or spam comments.
Will the ranking drop after the migration? As long as the old address is matched one-to-one and the main content does not change, short-term fluctuations will usually return. If it drops significantly and continues, first check the coverage of the redirect table instead of checking the content.