It is extremely easy to move your WordPress site using a backup plugin. But what if you only wanted to move a custom post type? In this article, we will show you how to import and export custom post types in WordPress. We will also show you how to import any custom taxonomies associated with your post types.
There are two steps involved in exporting and importing a custom post type in WordPress. First step involves migrating the actual custom post type and taxonomies. The second step is to import the post type data.
Often custom post types in WordPress are associated with their own custom taxonomies. We will show you how to export/import your custom taxonomies along with your post type.
Exporting Custom Post Types and Taxonomies in WordPress
Some users prefer to create their custom post types and taxonomies by adding code in their theme’s functions.php file or a site-specific plugin. In that case, all you need to do is copy that code and paste it on the site where you want to import them.
However, in some cases you may not be able to locate the code. Don’t worry you can still create the same custom post type on the new site.
All you need to know is the post key value. This is the name used for the post type in your WordPress database. You can find it by simply visiting the post type in your WordPress admin area.
You can also get custom taxonomy key by simply viewing the custom taxonomy in the admin area.
Use CPT UI plugin to create the same taxonomy on the target site where you want to import the taxonomy.
Repeat the process for all custom post types and taxonomies that you want to import.
Bonus Tip: If you used the CPT UI plugin to create your post type, then you can also use it to migrate them. But this only works if the original custom post type was created using this plugin. Visit the Import / Export section in the plugin settings and follow onscreen instructions.
Custom Post Types & Taxonomies Created by Plugins
Many popular WordPress plugins use custom post types and taxonomies to handle custom content types. For example, Soliloquy uses them to create sliders, eCommere plugins use them to create products, etc.
If you want to keep using those plugins, then you don’t need to import CPTs. Simply install the plugin on the target site, and you will have the custom post types and taxonomies ready on your site.
Many such plugins come with their own import/export features but if a plugin does not have that feature you can still export the data.
Exporting / Importing Custom Post Type and Taxonomies Data in WordPress
WordPress comes with a powerful import/export tool which allows you to export and import WordPress data. Simply go to Tools » Export.
You will see all your post types listed there. Select the post types you want to export and press the Download Export File button.
WordPress will now prepare an XML export file and your browser will start downloading it.
Now switch to your target site where you want to import this data. Go to Tools » Import. You will see a number of options, click on WordPress.
This will bring up a popup asking you to install WordPress importer plugin. Click on the install button and then click on Activate Plugin & Run importer link.
On the importer screen, you need to click on the choose file button and then select the XML file you downloaded earlier. Next, click on the upload file and export button.
WordPress will now import your custom post type data. All the custom post types you selected earlier will be imported. WordPress will also automatically add terms to the custom taxonomies.
That’s all, we hope this article helped you import and export custom post types and taxonomies in WordPress.
To leave a comment please visit How to Import and Export Custom Post Types in WordPress on WPBeginner.