In this article, we're going to show you how to export and import WordPress categories and tags, starting with a solid understanding of these two built-in taxonomies. We're also going to describe custom taxonomies and how to export and import them.
Here are the main section headings:
What are WordPress Categories and How are They Used?
What are WordPress Tags and How are They Used?
What are Custom Taxonomies and How are They Used?
How to Export WordPress Categories Separately From Posts
How to Export WordPress Tags Separately From Posts
How to Export WordPress Categories and Tags With Posts
How to Export WordPress Custom Taxonomies
Summary of Taxonomy Export Capabilities
How to Import WordPress Categories Separately From Posts
How to Import WordPress Tags Separately From Posts
How to Import WordPress Categories With Posts
How to Import WordPress Tags With Posts
How to Import WordPress Custom Taxonomies
Summary of Taxonomy Import Capabilities
A taxonomy is simply a system of organizing information. Most people are familiar with this concept because of the taxonomies created for living organisms, such as this one for the gray wolf:
As in this example, many taxonomies are hierarchal.
WordPress uses two main taxonomies: categories and tags. For added flexibility, it also supports custom taxonomies.
Categories are the broadest way to group WordPress content and are usually hierarchal. For example, the National Football League (NFL) consists of two conferences, each split into four divisions with four teams per division:
To create a website about this league, it would be natural to organize your site based on the league's structure:
NFC North (division)
Chicago Bears (team)
Detroit Lions (team)
Green Bay Packers (team)
Minnesota Vikings (team)
and so on...
All of these elements are good candidates for categories because even those at the lowest level — teams — may contain multiple posts that should be grouped together.
How are these categories used? When fans of the Chicago Bears visit your website, they can get all the information on their team simply by clicking the Chicago Bears category. If they want to access information on all the teams in the same division, they can go up one level in the hierarchy and click the NFC North category, and so on.
Without categories to organize your content, users would have to search your entire site to find related information.
Categories often represent the natural structure of a website and form key sections of its main menu.
Tags provide alternative ways of grouping your content that are non-hierarchal and often more descriptive than categories. In our NFL example, we might add tags to identify teams by geographical region, such as West Coast, East Coast, and Central. Or we might use them to indicate the expansion year when a team joined the league, such as Pre-1970, 1970, 1976, 1995, 1999, or 2002.
Tags do not normally represent the natural structure of a website. For example, you wouldn't organize your NFL website based on a team's geographical region because that is not the way the league organizes itself. Nor is it the most common way that users expect the information to be organized.
However, some users may occasionally be interested in viewing your content this way. When this happens, it is very convenient for them to be able to simply click a tag like West Coast to see all the teams that are on the west coast.
A common way of presenting and interacting with tags is to use a tag cloud like this:
In a tag cloud, the more a tag is used, the bigger its font. This helps users understand which tags are likely the most important.
Because categories typically reflect the natural way to organize a website (and there is usually only one way to do this), and tags represent multiple, alternative ways of viewing the same content, the average website has more tags than categories.
Another feature of tags is that they can be completely unrelated to each other. For example, there is no relationship between where a team is located and when it joined the NFL.
This freedom to use tags independently of each other has one main advantage and one main disadvantage when compared to categories. The advantage is flexibility: you can create tags for practically anything without having to reorganize your website or its menu system. The disadvantage is that, without the need to organize your tags, you may end up using too many of them and creating a giant tag mess.
Custom taxonomies allow you to create a custom system of organization that is often specific to a topic, industry, or set of tasks.
For example, say that you've created a shipping plugin that is heavily dependent on the presence of a hierarchal definition of geographic locations such as Region, Country, State, and Zip or Postal Code. If you create these definitions using built-in categories, any modifications to them might harm your shipping plugin. By creating a custom taxonomy, you can completely control both its hierarchal structure and its values.
In other cases, you may not care about the individual values in your custom taxonomy but still require a specific structure. For example, if you create a cookbook plugin, you may want to ensure that every Recipe consists of at least one Ingredient and one Step, even if the values for all these custom categories are used-defined.
You can also create custom tags when you want to enforce the use of specific descriptions.
And keep in mind, we're not just talking about the taxonomies themselves in these examples. A plugin's entire workflow and key parts of its interface may depend on the structures and/or values of its custom taxonomies.
This explains why the most common use of custom taxonomies is to support plugin functionality.
For all walkthroughs, we're going to use a version of WP All Import that includes both import and export functionality. If you don't have access to this plugin, you can use this free online sandbox. Just choose the WooCommerce Store option and click Create Sandbox.
WP All Export automatically detects all categories for a WordPress website. Here are the steps needed to export them on their own:
Navigate to All Export › New Export:
The Drag & Drop interface lets you configure your export columns.
All available data fields are listed in the Available Data section on the right. To include a data field in the export, simply drag it from the Available Data section to the column selection area:
Most of the available category fields are listed in the Standard subsection, which is fully expanded in the preceding image.
As you can see, there is also a Media subsection. This contains the data fields typically associated with category images or thumbnails, namely:
When you have finished selecting your export columns, click the blue Continue button at the bottom. This will bring you to the Export Settings screen.
There are two sections in this screen:
In this case, we'll leave both sections with their default settings and instead click the blue Confirm & Run Export button at the bottom.
After your category export has finished running, you will see the screen shown above.
If you left the export type at its default setting of CSV, you just need to click the blue CSV button to download your export file, as indicated by the red arrow.
If you changed the export type to Excel or XML, this button will change to reflect your selected type.
As an alternative, you can generate a secure URL by clicking the blue Generate button. This URL will remain valid even if you later change the export file name.
And that's it! That's a simple example of how to export WordPress categories.
The process of exporting WordPress tags separately from posts is identical to the process used to export categories, with one exception. At the beginning of the process, you simply choose an export type of Tags instead of Categories:
From a process standpoint, that's the only difference!
From the user's perspective, the process of including WordPress categories and/or tags while exporting posts is no different than including any data element attached to posts: you simply drag the taxonomies that you want to export into the column selection area. The magic occurs under the hood because WP All Export recognizes that it is dealing with taxonomy fields and formats its export data accordingly. For instance, when exporting the categories associated with a post, WP All Export will output the entire category hierarchy in one field like this: "NFC>NFC North>Chicago Bears".
Why does it format the data this way? Because it makes it possible to correctly parse all the categories AND their hierarchal relationships when the data is used, which is exactly what WP All Import does when it imports this kind of data.
Let's walk through a quick example of the export process.
Navigate to All Export › New Export, but, this time, export a post type of Posts:
When configuring your export columns in the Drag & Drop interface, expand the Taxonomies section in Available Data and drag your desired taxonomies into the column selection area. In the following example, we have selected both Categories and Tags.
Note how you do not get to select specific fields within these taxonomies. WP All Export will do that for you.
Finish your export, download your file, and open it in a spreadsheet application or other editor:
As you can see, the taxonomy data has been exported exactly as described earlier, i.e., with its hierarchal information intact.
One of the great things about WP All Export is that it standardizes a lot of exports that would otherwise require different procedures.
Such is the case with custom taxonomies. As our first example, let's look at exporting the custom product categories created by WooCommerce.
Navigate to All Export › New Export:
As you can see, there's nothing different here. WP All Export automatically recognizes Product categories as a taxonomy. This lets you select it as your export target the same way you would the built-in Categories or Tags selections.
The same is true with selecting the export columns, as shown in this next step.
Look familiar? The only difference is the Term Meta section at the bottom of Available Data, which simply contains any additional fields associated with product categories that don't fit into the standard data model.
What about exporting product categories as part of a product export?
Navigate to All Export › New Export:
You start by selecting WooCommerce Products as your export type, which makes perfect sense.
But what's really convenient is that the plugin also recognizes the relationship between products and product categories so that it knows which fields to present in the column selection process.
If you click the green Preview button, you will see that WP All Export handles custom taxonomy hierarchies the same way, too:
As you can probably guess by now, these are not a problem. WP All Export will automatically recognize custom tags the same way it does custom categories.
When working with WordPress taxonomies, it is important to know the differences between categories, tags, and custom taxonomies, as new WordPress users often get confused about these concepts and terms, which can lead to poor site design.
But when it comes to exporting taxonomies of any type, whether on their own or as part of another export, WP All Export really couldn't have made this any easier. You just have to master one basic process and let the plugin deal with any underlying differences.
WP All Import automatically detects all WordPress categories. The challenge in importing them is mapping the incoming data elements to the correct WordPress fields. Here are the required steps:
Navigate to All Import › New Import:
The purpose of this step is to verify that your import data has been correctly parsed. Most times, no adjustments are required. Still, this verification is important because, if a parsing problem does occur, it will likely cause serious errors during the import.
When your verification is complete, click the Continue to Step 3 button.
This interface lets you tell WP All Import where to apply the incoming data:
The mechanics of the interface are simple: you just drag the incoming data element to the appropriate target field.
The key is to know which fields to target. This is relatively simple when it comes to WordPress categories. If the incoming category data does not contain any hierarchal categories or images, the above mapping is all that is required. The termname incoming element becomes the category name, and the term slug will get automatically generated as part of the import.
However, if the data does contain hierarchies, you will need to scroll down, expand the Other Category Options section, and map the incoming parentname data element to the Parent Term field, as shown here:
WP All Import will use this information to recreate the category hierarchies during the import.
Click the Continue to Step 4 button to continue.
Here are the actions you need to take in this screen:
The import Confirm and Run screen provides a more complete summary of what will occur during the import process than does its export counterpart:
As with the Review Import File screen, you seldom have to take any actions in response to this screen. But it is still good practice to scan the Import Summary to verify that the import will do what you expect.
Once you've confirmed this, click the Confirm & Run Import button.
The import will run. When it completes, you will see this confirmation screen:
If you look closely at the messages at the top, the second message indicates that one of the import records was skipped. This is because it contained the Uncategorized category, which is already present by default in every WordPress install.
Otherwise, the import was a success!
We're not going to show you the entire process for importing WordPress tags separately from posts because it is nearly identical to importing categories. At the start of the process, the only difference is that you must select Tags as the taxonomies import subtype, not Categories:
After that, the remaining differences are:
This is where things start to get a bit more complicated. You have already seen an example of the basic import process, which depends mainly on the user mapping incoming data elements to the appropriate target fields. For a more in-depth description of this process, see How to Import Any CSV, XML, or Excel File into WordPress.
Importing posts follows the same process. Our area of focus for this article is the Taxonomies, Categories, Tags section in the Drag & Drop interface:
As you can see from this image, when you expand the Taxonomies, Categories, Tags section, you are presented with two options: Categories and Tags.
Here's what happens when you select Categories:
You are now presented with these four options:
Here is how to make the correct choice in this example:
When you select the Posts have hierarchal (parent/child) Categories (i.e. Sports > Golf > Clubs > Putters) option, you are presented with additional options:
These actions simply declare that, "My incoming categories are in a data element called categories, and they are hierarchal."
However, there is a much broader point here. There are a lot of options and sub-options in this process. That's because category data may be embedded in post data in many different ways. WP All Import addresses all of these potential incoming data structures while also allowing you complete flexibility in deciding how to handle those structures.
How do you know which options you should use and how to make the correct decisions? That's why WP All Import has written such extensive documentation (see the Related Information section at the bottom). If you're still unsure, just contact their support department.
The process of importing WordPress tags with posts is nearly identical to that of importing categories with posts, though a bit simpler:
As you can see, there are also options for posts with multiple tags, or you can enable mapping for tags, which allows you to treat incoming values as different tags based on your mapping rules.
Again, the point is that WP All Import has thought all this out in advance so that you can handle almost any scenario in which tags are attached to posts.
The rest of the import process is identical to that of earlier examples.
Importing WordPress custom taxonomies on their own is the same as importing any other taxonomy on its own.
For example, to import WooCommerce product categories, you simply choose Product categories as the Taxonomies subtype, and the rest should be completely familiar to you. As with any other taxonomy import, you just have to be aware that product categories are usually hierarchal.
Much the same can be said for importing custom taxonomies with custom post types. The general process itself doesn't differ from importing, say, built-in taxonomies with WordPress posts. But you do have to be intimately familiar with the custom entities in question.
For example, if you're importing WooCommerce product categories as part of a product import, the taxonomy portion of the import is going to look very similar to the example we showed you in the How to Import WordPress Categories With Posts section:
But if you're dealing with a different custom taxonomy and custom post type, you may find yourself needing one of the many taxonomy import options that we haven't explored in this article.
As the preceding sections have demonstrated, importing taxonomies can be much more complex than exporting them. Then again, that's true of any import vs export comparison. After all, WP All Export is aware of everything in the WordPress database. It isn't reliant on the user to help figure it out.
This isn't the case with imports, as import data might be in any format. It may even require translation from one set of terms to another on the fly.
All WP All Import can do when facing these unknowns is to arm you with the options that you need to manage them, which is exactly what it does.
Export WordPress Categories, Tags, and Custom Taxonomies - Plugin Description
Import WordPress Categories, Tags, Brands, and more - Plugin Description
Official Documentation: How to Export WordPress Categories and Tags
Official Documentation: Export Posts With Their Taxonomies
Official Documentation: How to Import WordPress Categories and Tags
Official Documentation: Nested, Hierarchical Taxonomies
Official Documentation: Taxonomy Meta & Images
How to Import and Export WordPress Users
How to Import and Export Advanced Custom Fields
How to Export and Import Gravity Forms Entries
How to Import and Export WooCommerce Customers
How to Export and Import WooCommerce Products
How to Export and Import Variable Products in WooCommerce
How to Import and Export WooCommerce Orders
Leave a Reply