Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Import and Export Custom Post Types in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

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.

Migrate Custom Post Types

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.

Getting the post type key

Once you have the post key, visit the site where you want to import the post type and use Custom Post Types UI plugin to create your custom post type.

Creating post type in CPT UI

You can also get custom taxonomy key by simply viewing the custom taxonomy in the admin area.

Getting taxonomy key in WordPress

Use CPT UI plugin to create the same taxonomy on the target site where you want to import the taxonomy.

Create Taxonomy in CPT UI plugin

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.

Exporting custom post type in an XML file using WordPress built in export tool

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.

WordPress import tool

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.

Installing WordPress importer plugin

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.

Importing WordPress using XML export file

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.

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

24 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Kerry says

    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 says

      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

  3. Bulut says

    There are people, Trouble Maker
    There are Bloggers, Trouble Eraser

    Thanks guys. You saved my day and time!

  4. Gabriela says

    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?

  5. Raf says

    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?

  6. Francis says

    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

  7. David says

    How can you export and have the option of exporting by month like you have when you export post and page?

  8. charles says

    When exporting custom post types it doesn’t export the featured image url path. Any idea how to resolve this?

    • Paul says

      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.

    • Carlitos says

      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.

  9. Jim D says

    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 says

      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

  10. Philip Downer says

    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.

  11. Kris says

    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

Leave a Reply to Paul Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.