Skip to content

Instantly share code, notes, and snippets.

@trey8611
Last active April 30, 2020 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trey8611/b416466a3199f81df0eada8a1f7786c6 to your computer and use it in GitHub Desktop.
Save trey8611/b416466a3199f81df0eada8a1f7786c6 to your computer and use it in GitHub Desktop.
WP All Import Workaround - How to import categories only in a posts import

How to import Categories only in a Posts import

When possible, you should use a standalone Taxonomies import to bring in categories only: https://d.pr/i/hteJyV. However, if your file contains hierarchical categories in a structure like this:

Parent Category > Child Category > Grandchild Category | Second Parent Category > Second Child Category > Second Grandchild Category | Third Parent Category > Third Child Category > Third Grandchild Category

Then, you can use the following workaround:

First

Start a "New Items" import ( https://d.pr/5s8uX9 ) and select the post type that's associated with the categories you need to import. For example, if you're importing WooCommerce Product Categories, you'll select "WooCommerce Products" in the drop down:

WooCommerce Drop Down

Second

Continue past step 2 and go straight to step 3 in the import. Now, type in a dummy title and dummy content for the product:

alt text

Fill in the "Taxonomies" section with your import field(s):

alt text

In the "Other Product Options" section, type "trash" (without quotes) in the Post Status field:

alt text

Third

Continue to step 4 and type in some static text as the Unique Identifier:

alt text]

Select "Choose which data to update" and deselect everything other than "Taxonomies" -> "Remove existing taxonomies, add new taxonomies":

alt text

Run the import

This will bring in all of your taxonomies and leave a single dummy post in the trash bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment