Opened 13 years ago
Closed 11 years ago
#23378 closed enhancement (wontfix)
wp_(insert|update)_term() should accept term slug as 'parent' argument
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | has-patch |
| Focuses: | Cc: |
Description
For those programmatically using wp_insert_term() and wp_update_term(), it would be great if the 'parent' argument could be a term_id or term slug.
Attachments (3)
Change History (6)
#1
@
13 years ago
We discussed this at dinner the other night and realized where it would break is when the term name (and slug) is an ID.
If this enhancement was of general interest, it would probably be better to go with a new parent_slug argument or similar.
#2
@
13 years ago
In general: we treat an integer as an ID, and a numeric string as a slug. While that could work here, adding this behavior to a function after the fact can result in compatibility issues.
#3
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
As of WP 4.1, it's possible for terms in different taxonomies to have the same slug, and it's possible that at some point we'll allow terms in the same taxonomy to share slugs as long as the taxonomy is hierarchical and the terms are not siblings. This introduces the possibility of ambiguity when identifying a parent merely by slug. Forcing the plugin author to fetch the term ID (using get_term_by( 'slug' ) or whatever) and then passing the ID to 'parent' makes it so that WP doesn't have to make educated guesses in ambiguous cases. For this reason, I'm marking wontfix.
Added unit tests for wp_(update|insert)_term with parent