In the previous steps, we retrieved the list of blog articles and made it possible to view the post list in Sanity Studio. This time, we'll perform more detailed processing on the content being posted.
The official page regarding the procedure here is as follows.
About Content Types
The types of content managed in WordPress for this project include blog posts, along with associated tags, pages, editors, and other items. We will add processing to migrate each data type and map it to the predefined schema.
For example, if migrating tag data, you would enable migration by executing a command like the following.
Content Type Definition
Regarding content types, add definitions to the file migrations/import-wp/constants.ts.
Next, create the file `./migrations/import-wp/lib/getDataTypes.ts` and add the following code to enable switching processing based on command-line arguments.
To enable the file created above, update the file migrations/wp-import/index.ts as follows.
This enables execution for each type. First, execute the following command for posts.
Once you have confirmed that the processing was successful, proceed to execute the following command.
Since the original site does not utilize multiple users, no data will be imported for the final users. You can verify below that the page data is being passed to the correct data schema type.

Data Migration Tailored to Post Types
Up until now, we've been operating by migrating only the titles and content, making it work for all post types. In reality, adjustments to the data migration process are necessary for each specific content type. We will now proceed with this part.
Create the type definition file for Sanity Studio
We will generate type definition files from the schema definitions already defined in Sanity Studio. This can be accomplished through the following steps:
First, output the schema information as a JSON file.
Executing the above command creates a schema.json file. To generate the type definition file using the created file, execute the following command.
The `sanity.types.ts` file has been created, establishing the type definition file for the content types managed in Sanity Studio.
Update to Migration Script
We will now add the procedures to migrate data for each post type. First, to process blog posts, add the file `migrations/import-wp/lib/transformToPost.ts`.
To enable this processing when called with `post` as an argument, update the file `migrations/import-wp/index.ts` as follows:
Optimize for blog posts
In the code for `migrations/import-wp/lib/transformToPost.ts`, only title processing has been added so far. We will add code to migrate data according to the actual content types being prepared.
For example, the code for slugs would look like this:
Regarding categories, they are referenced using IDs, and multiple categories can be specified. Therefore, we will add the following processing:
Similarly, add the codes for editor, date, status, and tags.
If you have custom metadata fields, please refer to the official documentation. It describes the steps to add a schema defined in Sanity and copy the data there.
The final updated file will look like this.
We will now perform the import procedure for posts.
After execution, you can verify that data such as slugs has been added when checking the content in Studio.

Summary
This time, we progressed to importing the basic data for the Post data. The results of the steps taken so far are published in the following branch.
In the next step, we will proceed with migrating assets such as images.