It doesn’t take a lot of effort to move your WordPress website from one location to another. In fact, backup plugins and cloning techniques work exceptionally well for this. However, this isn’t practical in some instances. Perhaps you only want to move the WordPress custom post types.
Custom post types are pieces of content that are outside of the normal posts and pages WordPress provides. For example, the WPMovieLibrary plugin adds a custom post type while giving you the ability to display movies on your site.
In this article, I’ll demonstrate how to import and export custom post types in WordPress. It’s a simple procedure depending on how elaborate you’ve made your website.
Manually Exporting Custom Post Types
Essentially, you have two different aspects to certain custom post types. You have the type itself and the taxonomy that accompanies. However, not all custom post types have taxonomies to export.
For the sake of this tutorial, though, let’s use an example that does have some kind of taxonomy. In this sample, I am installing the plugin, “WPMovieLibrary.” Not only is it a good plugin for displaying movies, but it’s also a good example of custom post types and taxonomies.
So, let’s say I want to find the post types that are used in the Movie Library plugin. First, I will go to the Movies area and click, “All Movies.” This is because I want the custom posts for the movie titles and information.
Of course, your custom post types will probably be different. This completely depends on the plugin you use and the types of content you create.
In the address bar, you’ll see “post_type=” portion of the URL. The word or phrase after post_type= is the name of the custom post type. In this case, it’s the word, “movie.”
This is called the “Post Key.” Write this word down somewhere you’ll remember as it will be important in the next step.
What if you need to grab a taxonomy as well? This is done in a similar manner. Depending on the plugin, you’ll need to access how it separates the custom post type. For instance, the movie plugin I am using has a section for “genres” to categorize the titles.
After clicking the genres section, I can find the taxonomy of the custom post types in the address bar. This is displayed in the same fashion as the post type. Your taxonomy is the word or phrase after “taxonomy=.”
Do this for all of your custom post types and taxonomies you want to move from one website to another.
Adding Custom Post Types to New WordPress Site
The next step is to add your types and taxonomies to the new website. This is when you install and activate the Custom Post Type UI plugin.
Input the custom post type from the old website.
Do the same for any taxonomies you need to add as well.
Make sure you check the correct box next to the custom post type for the taxonomy.
An easier way to go about importing and exporting data from custom post types is by using the plugin’s own ability to do this.
Many plugins in WordPress are built with the import/export option readily available to simplify this entire process.
Using WordPress to Export and Import Custom Post Types
Moving data from one WordPress website to another is actually fairly easy in most cases. While some people simply do this from restoring a backup of the site, perhaps the best way is to use the built-in tools of WordPress itself.
Exporting
From the WordPress dashboard of the old site, go to Tools and click, “Export.”
Choose the custom post data you want and click “Download Export File.”
You will download an XML file that WordPress will use to grab the correct information you’re transferring.
Importing
From the new website, go to Tools and click, “Import.”
Before you can import data for WordPress, you’ll need to install the actual importer plugin. Unfortunately, the WordPress export posts plugin is not installed by default. However, it’s a quick install that takes mere seconds.
If you don’t have it yet, click the “Install Now” button under WordPress in the Import window.
Click “Run Importer” once you have the import plugin for WordPress installed.
Choose the XML file you saved and click, “Upload file and import.”
WordPress will then do the rest. This includes assigning the taxonomies as well as the terms and post types.
This is a much simpler method than trying to import them manually, but it doesn’t support those custom post types you create in code. For that method, you’ll have to go through the steps mentioned earlier while using CPT UI.
Don’t Forget Your Data When Moving Websites Around
The import/export function of WordPress works exceptionally well for most custom post types, especially those created by plugins. Depending on the size of your site, you can move WordPress post and page data relatively quick. Make sure you have everything before deactivating the old website. You may find it difficult to retrieve important information if the site is no longer accessible.
Have you moved your WordPress site from one domain to another in the past? What kind of plugins do you use that create custom post types?
In this way can we export and import custom fields as well?
You will probably need a custom, pro plugin of some sort. Feel free to google and see what is available.