---
title: "Bulk Change WordPress Post Categories with a CSV (Replace, Not Add)"
url: "https://wpimportexport.com/bulk-change-wordpress-post-category-from-csv/"
description: "Move WordPress posts out of Uncategorized or into new categories: export ID and categories, edit them in a spreadsheet and import them back."
type: post
published: 2026-11-30T09:00:00+00:00
modified: 2026-11-26T08:32:02+00:00
categories: ["Tutorials"]
tags: ["CSV Export"]
docs_topics: ["Bulk updates and automation"]
---

# 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](https://wpimportexport.com/wp-content/uploads/2026/11/export-posts-in-uncategorized-filter-1024x752.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/export-post-id-title-category-names.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/import-update-post-categories-by-id-1024x957.webp)

_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](https://wpimportexport.com/wp-content/uploads/2026/11/import-categories-14-posts-updated-1024x532.webp)

_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.

## Related Guides

- [Export WordPress Posts with Featured Image URL and Categories to Excel](https://wpimportexport.com/export-wordpress-posts-featured-image-url-excel/)
- [How to Assign Post Authors When Importing WordPress Posts from CSV](https://wpimportexport.com/import-wordpress-posts-assign-author-csv/)
- [Fixing Wrong Dates, Lost Leading Zeros and Scientific Notation in an Exported CSV](https://wpimportexport.com/excel-leading-zeros-dates-scientific-notation-csv/)

Get the free plugin on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
