#36690 closed enhancement (fixed)
Improve documentation on deleting all terms associated with an object
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.8 | Priority: | normal |
| Severity: | normal | Version: | 4.6 |
| Component: | Taxonomy | Keywords: | has-patch 2nd-opinion good-first-bug |
| Focuses: | docs | Cc: |
Description
While looking for a way to delete all terms related to an object I first looked at wp_remove_object_terms(). That function however expects the slug(s) or ID(s) of the term(s) to remove as a parameter and cannot be used for removing all terms at once.
The right way to do this appears to be passing an empty array or null/false for the $terms parameter to the wp_set_object_terms() function.
It would be helpful to update the documentation of the wp_set_object_terms() function (or both).
Attachments (2)
Change History (10)
This ticket was mentioned in Slack in #docs by morganestes. View the logs.
9 years ago
#3
@
9 years ago
I think we should avoid using mixed if we know exactly what to expect for a parameter's value, so @param array|int|string $terms is fine, but the order in the description should match the order of the types.
#5
@
9 years ago
@morganestes Thanks for your feedback. I replaced mixed with array|int|string. Should there also be a reference added to wp_remove_object_terms()? That would probably be the first function one would look at when trying to delete all terms associated with an object.
Updates the description of the $terms param