Moving your WordPress site with a backup plugin is simple. But if you only want to move a custom post type, things can get tricky, as they often have their own taxonomies.
In this article, we will help you import and export custom post types in WordPress. You will also learn to import custom taxonomies linked to your post types.
There are 2 main steps to follow. First, you will move the custom post type and its taxonomies. The second step is to import your custom post type’s data.
What Are Custom Post Types in WordPress?
Custom post types in WordPress let you create different kinds of content beyond the usual posts and pages. By creating a custom post, you can organize and display various content types easily.
For example, if you run a review site, you might have a custom post type for ‘Movies,’ ‘Books,’ or ‘TV Shows.’
Now, there are times when you might need to import and export these custom post types.
Maybe you’re moving your site to a new host or merging multiple sites together. It’s also handy if you’re sharing your setup with someone or duplicating your WordPress site with the same structure.
However, moving custom post types can be tricky. These types often come with their own custom taxonomies, like genres for movies or categories for products. If you don’t move these taxonomies correctly, it can lead to broken links and lost information.
So, knowing how to handle custom post types when moving your site can save you a lot of trouble.
In the following sections, we will share how to import and export custom post types in WordPress. Here’s a quick overview of all the methods we will talk about:
Related: Wait, do you need custom posts at all? You might want to check out our guide on when do you need a custom post type or taxonomy in WordPress.
Ready? Let’s get started.
Method 1: Exporting Custom Post Types and Taxonomies in WordPress (Free)
Advanced users may prefer creating custom post types and taxonomies by adding code to their theme’s functions.php file or a site-specific plugin. With this method, you just need to copy the code and paste it into the new site.
But sometimes, finding the code can be tough.
The easier way to do this is to create the same custom post type on the new site. You just need to know the ‘post key value.’
The post key value is the name your WordPress database uses for the post type. You can find it by visiting the post type in your WordPress admin area. Then, simply look for the name in the settings or the URL when you’re on the post type’s page.
Once you have the post key, you’ll want to visit the site where you want to import the post type. After that, you can use the Custom Post Types UI plugin to create your custom post type.
So, let’s install and activate Custom Post Types UI. If you need help, you can see our guide on how to install a WordPress plugin.
Upon installation, you’ll want to navigate to CPT UI » Add/Edit Post Types from your WordPress admin area.
Then, you can type the post key value into the ‘Post Type Slug’ field and complete other custom post type details. Don’t forget to check the box next to ‘I’m trying to migrate things in to CPTUI, let me save this.’
Go ahead and click the ‘Add Post Type’ button when you’re done.
Now, you’ll want to go back to your older WordPress site to export your custom taxonomy using the ‘taxonomy key value.’
You can find your custom taxonomy key by looking at the URL when viewing the custom taxonomy in the post editor.
Simply copy the custom taxonomy key to your clipboard and go back to the new website.
Once you’re in the admin area, you’ll want to navigate to CPT UI » Add/Edit Taxonomies to create the same taxonomy.
Then, simply paste the taxonomy key to the ‘Taxonomy Slug’ field and complete the rest of them. Don’t forget to click the ‘Add Taxonomy’ button to save your progress.
Now, you can 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. You can visit the ‘Import / Export’ section in the plugin settings and follow onscreen instructions.
Method 2: Custom Post Types & Taxonomies Created by Plugins (Recommended)
Many popular WordPress plugins use custom post types and taxonomies to handle custom content types. For example, Soliloquy uses them to create sliders, eCommerce plugins use them to create products, and so on.
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 have their own import/export features, but even if a plugin does not have that feature, you can still export the data.
Method 3: Exporting / Importing Custom Post Type and Taxonomies Data in WordPress (Easy)
WordPress comes with a powerful import/export tool that allows you to export and import WordPress data. Simply go to Tools » Export.
You will then see all your post types listed there. So, go ahead and select the post types you want to export and press the ‘Download Export File’ button.
WordPress will then prepare an XML export file, and your browser will start downloading it in no time.
Once done, you can switch to your target site where you want to import this data.
From the admin area, you’ll want to navigate to Tools » Import. In the ‘WordPress’ section, go ahead and click ‘Install Now.’
Upon installation, the button will change to ‘Run Importer.’ Simply click on it, and you’ll see the importer screen.
Here, you’ll need to click the ‘Choose File’ button and select the XML file you downloaded earlier. After that, you can click the ‘Upload file and import’ button.
WordPress will now import your custom post type’s data. All the custom post types you selected earlier will be imported.
Plus, WordPress will 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. Next, you might want to check out our guide on how to include custom post types in WordPress search results or our expert pick of the most useful WordPress custom post types tutorials.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Kerry
I am trying to export CPT data, but the WP export tool doesn’t list the CPT. I’m using the CPT UI plugin. Any help?
WPBeginner Support
For that specific plugin, you would want to check under CPT UI, Tools and you should see that plugin’s specific method for importing and exporting post types.
Admin
Bulut
There are people, Trouble Maker
There are Bloggers, Trouble Eraser
Thanks guys. You saved my day and time!
WPBeginner Support
Glad our guide was helpful
Admin
Gabriela
Hi!
We are switching themes – we want a new site basically – hopefully with a cleaner backend. The switch is from a custom-built theme to a new theme.
Would it be best to install a new theme within our same back end, or would it be cleaner to export and import into a new backend?
Raf
Clear incoherence between title and intent and practical advises:
1) says “Exporting Custom Post Types and Taxonomies in WordPress”
2) says “in some cases you may not be able to locate the code.”
3) says “Don’t worry you can still create the same custom post type on the new site.”
So if the post-type is created using the UI : you can not export it but only create it again. Why the article doesn’t clearly state it?
Francis
So let say for instance if I was using a paid plugin that has to do with custom posts and want to switch to the free version how will i go about it? Am still very new to wordpress
stefano
Hi, can I ask you what plugin do you use for the social share?
thanks
WPBeginner Support
Hi Stefano,
We use custom code written specifically for our own use.
Admin
David
How can you export and have the option of exporting by month like you have when you export post and page?
charles
When exporting custom post types it doesn’t export the featured image url path. Any idea how to resolve this?
Amy
Can I export a custom type type and import it as a different post type? Is that possible?
Paul
I’m trying to do this too, which is why I landed here. I’m trying to rename a custom post type without losing the post data. Not having much luck.
Jhony Penagos
Thank you !! It work for me.
Chris
Does related custom field data get packaged with the custom post type export?
Carlitos
It does not. you will want to bring that over either in your functions file or enter it in manually if you are using a plugin.
Jim D
Is this something you would need to do if you are using a custom post type currently and wish to switch to a different theme?
WPBeginner Support
It depends on how you created the custom post types in the first place. If these custom post types were created by your old theme then you will need to export them before switching theme. If the custom post types were created using a plugin then they would remain unaffected when you switch the theme. Lastly, if you created the custom post type by adding code into your theme’s functions file then you just need to copy that code and paste it in your new theme.
Admin
Philip Downer
This article should have a bit of clarification. As Kris touched on, you can only import a custom post type if that specific custom post type actually exists on the destination site. You’ll need to either export and include the code that registers the post type; or if you’re using a plugin to handle custom post types, you’ll need to ensure that the same settings are used.
WPBeginner Support
If you take a look at the article, the first section is about duplicating the CPT to the site where you want to import CPT data.
Admin
Kris
Not to forget: themes also make their own custom post types (portfolio for example). Not only moving a site, but also switching themes can also be difficult
I ended up coding the post type and taxonomies in a separate site-specific plugin with the aid of generatewp.com; I was surprised how easy it went and found it less confusing then CPT-UI
Sophia
What does importing and exporting custom post types do? Sorry, I’m such a newb.
WPBeginner Support
It comes in handy when you specifically want to move content from a custom post type to another site.
Admin