Skip to main content

wp term update

Overview

Edit an existing taxonomy term — rename it, change its slug, update its description, or reparent it within a hierarchy. All changes persist immediately.

What It Does

wp term update calls wp_update_term() for the specified term and applies the provided field changes.

Syntax

wp term update <taxonomy> <term-id> [OPTIONS]

Arguments & Options

FlagDescription
--name=NAMENew display name
--slug=SLUGNew URL-friendly slug
--description=TEXTNew description
--parent=TERM_IDNew parent term ID

Basic Usage

Rename a category

wp term update category 12 --name="Tech & Science"

Update slug after renaming

wp term update category 12 --slug="tech-and-science"

Move a subcategory to a new parent

NEW_PARENT=$(wp term get category devops --by=slug --field=term_id)
wp term update category 25 --parent=$NEW_PARENT

Real-World Scenarios

Scenario 1: Rename and fix slug after a typo

# Find term ID by slug
ID=$(wp term get category "tehcnology" --by=slug --field=term_id)
wp term update category "$ID" --name="Technology" --slug="technology"

Scenario 2: Bulk update term descriptions

while IFS=',' read -r id description; do
wp term update category "$id" --description="$description"
done < term-descriptions.csv

Quick Reference

wp term update <taxonomy> <id> --name="New Name"
wp term update <taxonomy> <id> --slug=new-slug
wp term update <taxonomy> <id> --parent=<parent-id>
wp term update <taxonomy> <id> --description="New description"

Next Steps