Back to blog
5 min read Tutorials

Bulk Change WordPress Post Categories with a CSV (Replace, Not Add)

WordPress lets you add a category to many posts at once with Bulk actions > Edit, but not replace one: the old categories stay, and every post gets the same new one. When dozens of posts sit in “Uncategorized”, or a category restructure gives each post a different home, a spreadsheet is faster: one row per post, the new categories in one column. Import Export by RockStarLab exports the posts with their current categories and imports the edited file back, replacing each post’s categories with the ones in its row.

Free: everything here works in the free plugin. We tested with Import Export by RockStarLab 2.2.13 and WordPress 7.1.

Short Answer

Export the posts with three columns, ID, Title and Category Names. In Excel or Google Sheets, type the new categories, separated by commas, into the Category Names column. Import the file back as Blog Posts with Check for Existing Items by Field: ID, If Match Found: Update and If No Match Found: Skip. Each post gets exactly the categories in its row; categories that don’t exist yet are created.

Step 1: Export the Posts with Their Categories

In Import Export by RockStarLab > Export, choose Blog Posts. We wanted the posts still in Uncategorized, so on the Filters step we added a Taxonomy Filter (taxonomy category, Has Term(s), Uncategorized) and limited it to recent posts with Date greater or equal to 13 Nov:

Export filters: Taxonomy Filter category Has Term(s) Uncategorized and Date greater or equal 13/11/2026, 20 items available
The posts still in Uncategorized.

The Uncategorized filter also includes posts in subcategories of Uncategorized, which is how WordPress treats category filters. On the Fields step we used three columns:

Export fields ID, Title and Category Names
Three columns are enough.

ID tells the import which post a row belongs to; Title is there so you know what you are editing.

Step 2: Edit the Category Names Column

Open the CSV in Excel, Google Sheets or LibreOffice and type the new categories. We changed 14 posts:

ID post_title category_names
7346 Friday Cupping Notes Coffee Origins, Tasting
7345 First Roasts on the New Roaster Roasting Notes
7274 How We Taste New Coffees Tasting
7271 Café Partner Downloads Wholesale
7269 Gift Cards Are Here Shop News > Gift Ideas
7239 Holiday Opening Hours Shop News
7245 Our New Office (empty)
…and seven more rows
  • Several categories: separate them with commas.
  • Subcategories: write the path with >, for example Shop News > Gift Ideas.
  • Rows you don’t want to change: delete them from the file. An empty Category Names cell also leaves the post’s categories as they are.

Save the file as CSV (UTF-8).

Step 3: Import the File Back

In Import, choose Blog Posts and upload the file. Auto Map mapped ID to ID, post_title to Title and category_names to Categories. On the Options step:

Import Options: Check for Existing Items by ID, If Match Found Update, If No Match Found Skip
Update by ID, skip unknown IDs.
  • Check for Existing Items by Field: ID, If Match Found: Update: each row updates its post.
  • If No Match Found: Skip: no new posts if an ID is wrong.

The import updated all 14 posts in one second:

Import finished: 14 successful, 14 updated, 0 created, 0 failed
14 posts updated.

What Changed

  • Every post got exactly the categories in its row, and Uncategorized was removed. “Friday Cupping Notes” now has Coffee Origins and Tasting.
  • Categories that didn’t exist were created: Tasting, Wholesale, Shop News and Gift Ideas.
  • Shop News > Gift Ideas created Gift Ideas as a child of Shop News and put the post in Gift Ideas only. Add Shop News to the cell too if the post should also be in the parent.
  • “Our New Office”, with an empty cell, kept Uncategorized.
  • Titles, content, dates and other fields didn’t change: the import updates only the mapped columns, and the titles were the same as before.

With WP-CLI or an AI Agent

The same two steps run from WP-CLI: export the posts of a category with the three columns, edit the file, import it back by ID.

wp rsl-ie export --type=post --fields=ID,post_title,category_names --options='{"filters":[{"field":"category","type":"taxonomy","taxonomy":"category","condition":"in","value":["uncategorized"]}]}' --name=uncategorized-posts --user=admin
wp rsl-ie import categories-new.csv --type=post --unique-field=ID --if-exists=update --options='{"if_not_exists":"skip"}' --user=admin

We ran them on a test site with Import Export by RockStarLab 2.2.63: export job 7 listed the four posts in Uncategorized, and import job 8 moved three of them to Coffee Origins and Tasting, Roasting Notes, and Shop News > Gift Ideas, creating the categories that were missing. The row we removed from the file kept its category.

An AI agent can also write the new categories for you. Through the WordPress MCP Adapter, WordPress itself gives it only read-only abilities for site, user and environment information; Import Export by RockStarLab adds the export with your columns and the import that replaces the categories:

With Import Export by RockStarLab, export the posts in Uncategorized with ID, title and category names. Suggest a category for each from the existing ones, show me the table, and after my OK import it back by ID, updating only the categories.

Only the three columns go into the file, so titles, content and dates cannot change, and you approve the table before anything is imported.

Tips

  • Tags work the same way: add the Tag Names column to the export and edit it.
  • Spelling matters: “Roasting notes” and “Roasting Notes” match the same category, but “Roasting Note” creates a new one. Copy names from Posts > Categories if in doubt.
  • Back up first: the import asks you to confirm a database backup before it starts.

FAQ

How do I bulk change the category of WordPress posts?

Export the posts with ID and Category Names, edit the category column in a spreadsheet, and import the file back with Check by ID and Update. Each post gets the categories in its row.

Does the import add the categories or replace them?

It replaces them: after the import, the post has exactly the categories in its row. An empty cell leaves the categories unchanged.

How do I remove posts from Uncategorized in bulk?

Export the posts in Uncategorized, give each row its real category, and import the file back. Because the categories are replaced, Uncategorized is removed.

Can I assign subcategories from a CSV?

Yes. Write the path with “>”, such as “Shop News > Gift Ideas”. Missing parents and children are created.

Get the free plugin on WordPress.org.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE