Skip to main content

wp term generate

Overview

Quickly create large numbers of test taxonomy terms for staging environments, testing pagination, and UI development. Terms are generated with random names automatically.

What It Does

wp term generate creates N terms in the specified taxonomy using randomized names. Useful for populating dropdowns, testing infinite scroll, and validating category archives.

Syntax

wp term generate <taxonomy> [OPTIONS]

Arguments & Options

FlagDefaultDescription
--count=N100Number of terms to generate
--max_depth=N1Depth of hierarchy for hierarchical taxonomies
--format=FORMATprogressprogress or ids

Basic Usage

Generate 20 test categories

wp term generate category --count=20

Generate product categories with nesting

wp term generate product_cat --count=30 --max_depth=3

Generate and capture IDs

wp term generate post_tag --count=10 --format=ids

Real-World Scenarios

Scenario 1: Test tag cloud rendering

wp term generate post_tag --count=100

Scenario 2: Test deep hierarchical categories

wp term generate category --count=50 --max_depth=5

Scenario 3: Cleanup after testing

for id in $(wp term list category --field=term_id); do
wp term delete category "$id"
done

Quick Reference

wp term generate <taxonomy> --count=20
wp term generate category --count=50 --max_depth=3
wp term generate post_tag --count=100 --format=ids

Next Steps