#21639 closed defect (bug) (duplicate)
wp_update_term doesn't honor taxonomy
| Reported by: | Whissi | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Taxonomy | Version: | 2.3 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Hi,
I wanted to programmatically change my categories. This is the code I would use:
[...] foreach ( $categories_to_rename AS $category ) { $cat_ID = (int) $category->cat_ID; if ( $cat_ID === 1 ) { // Skip default category continue; } $updatedCategory = array(); $updatedCategory['slug'] = getTheNewCategoryNameFromSomewhere( $cat_ID ); $update_response = wp_update_term( $cat_ID, 'category', $updatedCategory ) if ( is_wp_error( $update_response ) ) return $update_response; } [...]
After that I noticed, that the slug of some tags were changed, too.
I looked into the database and noticed, that some tags shared the same term with a category. Because I updated the slug, which is stored in the terms table, the tag name was "updated", too.
This is something I don't expect. When I call an update on "category", I don't expect that something else will update, too.
When it is allowed, that a category and a tag will share the same term, this sharing should end when you update just one part.
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
dupe of #5809