In the process of moving content from one site to another I needed to change the post type, which is easy with a plugin like Post Type Switcher.
However, this doesn’t bring along the comments.
Post type switcher now migrates comments with the post.
This process turned out to be much more complicated than I had originally hoped, however with the aid of multiple plugins I was able to achieve it.
Step 1 – Create Post Types
Plugin: Custom Post Type UI
The first step is to create the custom post type that will be the target for the migration, I used the Custom Post Type UI plugin to achieve this. One nice thing about this plugin is it will export your post types and taxonomies in PHP code that you can add directly to a themes function.php file. Make sure to set the advanced options to include comments and other options that you need. It lets you easily add custom argument to a post type which is another nice feature. I almost exclusively use the Genesis Framework so it was easy to add Genesis archive support to the new post type right in the GUI.
Update July 5, 2019
The Post Type switcher plugin now migrates (published) comments when you change the post type!
What About Taxonomies?
I had intended to migrate the taxonomies as well but couldn’t find a quick solution. In my case the taxonomies were less important and I wanted to re-categorize things anyway so I went ahead and manually updated the taxonomies. If anyone has a solution for migrating the taxonomies I’d love to hear about it in the comments.
Update: I need to do this again with a different site and so tried the Taxonomy Switcher plugin.
Though outdated, the Taxonomy Switcher plugin still worked for me as of July 5, 2019 on wp 5.2.2 . In combination with the Post Type Switcher and bulk edit it was a few clicks to move all of my categories and tags along with the post after changing their post type.
Step 2: Plugin: Post Duplicator In step 3 I use the Copy / Move Comments plugin to move the comments to the new post, however we first need to have the post available to copy to. It is easy to change post types with Post Type Switcher plugin, however this doesn’t help when we need to copy the comments. So instead I used the Post Duplicator plugin. Post Duplicator has some great settings, one of which duplicates a post directly into a new post type. I used the Post Duplicator plugin to move all the posts with comments one by one and the Post Type Switcher plugin to bulk move all the rest. In the settings area of Post Duplicator you can: Set the Post Status Set the Post Type Set the Post Date Set or Clear the new Duplicate Title Set or Clear the new Duplicate Slug Step 3: Plugin: Copy/Move Comments Now that we have a duplicate of the post in the new post type, we can copy the comments over. The copy or move comments plugin offers this functionality, but only one post at a time. On a large site, I’m afraid this would be prohibitively slow. You only need to select which post to move from and which post to move to. Once I had migrated all the posts and comments I went ahead and deleted the old versions.