Recipe: organize posts with taxonomies
Use this recipe to classify existing content, not to rewrite it. Taxonomy availability and permitted terms are site-specific.
Read post [POST ID], list taxonomies available for its post type, and read its
current term assignments. Compare those with this classification request:
[REQUEST]. Search existing terms before proposing new ones. Show the exact
term IDs to add or remove and whether the assignment call will replace or
append. Do not write until I confirm. Apply the smallest supported change,
then read the post's terms back.
Replace versus append
wp_add_post_terms replaces the post’s existing terms in that taxonomy unless append is true. Use replacement only when the prompt supplies the complete intended set. Use append for an additive classification while preserving current terms. Removing one term should use the specific removal path rather than rebuilding an incomplete set from memory.
Creating or editing terms requires stronger taxonomy capabilities than basic term reads. Term-meta operations also require category-management access and reject credential-like key names.
Do not create near-duplicate terms to work around a spelling or hierarchy question. Present the existing names, slugs, and IDs and ask the user to choose when intent is ambiguous.
Related guides: taxonomy workflows, term assignment, and taxonomy tool reference.