Taxonomy Management Tasks
These tasks manage WordPress taxonomies (tags and categories), allowing you to remap or delete them individually or in bulk.
TaxonomyRemapTask
Class: Maintenance::Wordpress::TaxonomyRemapTask
Remap or delete a single WordPress taxonomy. When remapping, all posts with the source taxonomy get the destination taxonomy added before the source is deleted.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
locale | string | Yes | - | WordPress site locale (e.g., en, fr, it) |
taxonomy | string | Yes | tags | Either tags or categories |
source_identifier | string | Yes | - | The term_id (numeric) or slug of the source taxonomy |
destination_identifier | string | Conditional | - | Required for remap operations |
delete_only | boolean | No | false | Delete without remapping posts |
Operation Modes
Remap Mode
When destination_identifier is provided and delete_only is false:
- Finds all posts with the source taxonomy
- Adds the destination taxonomy to each post
- Deletes the source taxonomy
Delete Only Mode
When delete_only is checked:
- Deletes the source taxonomy directly
- Posts that had this taxonomy lose it (no remapping)
Examples
Remap tag by term_id:
locale: en
taxonomy: tags
source_identifier: 123
destination_identifier: 456
delete_only: false
Remap category by slug:
locale: fr
taxonomy: categories
source_identifier: old-category-slug
destination_identifier: new-category-slug
delete_only: false
Delete tag without remapping:
locale: it
taxonomy: tags
source_identifier: unused-tag
delete_only: true
Validation Rules
localemust be present and inI18n.available_localestaxonomymust be eithertagsorcategoriessource_identifieris always required- Cannot specify both
delete_onlyanddestination_identifier destination_identifieris required when not usingdelete_only
BulkTaxonomyRemapTask
Class: Maintenance::Wordpress::BulkTaxonomyRemapTask
Process multiple taxonomy operations from a CSV file. Each row can specify a remap or delete action.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
locale | string | Yes | - | WordPress site locale |
taxonomy | string | Yes | tags | Either tags or categories |
| CSV File | file | Yes | - | CSV with taxonomy operations |
CSV Format
The CSV must have these columns:
name,slug,term_id,count,action
| Column | Description |
|---|---|
name | Display name of the taxonomy (informational) |
slug | URL slug of the taxonomy (informational) |
term_id | WordPress term ID used for identification |
count | Number of posts using this taxonomy (informational) |
action | Operation to perform (see below) |
Action Column Values
| Value | Operation |
|---|---|
Numeric (e.g., 456) | Remap to taxonomy with this term_id |
delete or R | Delete without remapping |
| Empty or other | Skip this row |
Example CSV
name,slug,term_id,count,action
Old Tag,old-tag,123,45,456
Unused Tag,unused-tag,124,0,delete
Typo Tag,typo-tag,125,10,R
Keep This,keep-this,126,100,
In this example:
- Row 1: Remaps term 123 to term 456
- Row 2: Deletes term 124 (using
delete) - Row 3: Deletes term 125 (using
R) - Row 4: Skipped (empty action)
How It Works
The bulk task enqueues individual TaxonomyRemapTask runs for each actionable row:
Workflow
- Export taxonomy list using
ExportTaxonomyTask - Open CSV and add an
actioncolumn - Fill actions for each taxonomy you want to modify
- Upload the modified CSV to
BulkTaxonomyRemapTask - Monitor individual
TaxonomyRemapTaskruns in the UI
Performance Considerations
Each row with an action enqueues a separate maintenance task. For large operations:
- Tasks run asynchronously in the background
- Monitor progress in the maintenance tasks UI
- Individual task failures don't affect other rows
Related Tasks
- ExportTaxonomyTask - Export taxonomy lists to CSV for bulk operation preparation