Opened 8 years ago
Closed 7 years ago
#41427 closed defect (bug) (invalid)
wp_set_object_terms creates new terms instead of linking existing ones
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.8 |
| Component: | Taxonomy | Keywords: | close reporter-feedback |
| Focuses: | Cc: |
Description
Function wp_set_object_terms doesn't behave as expected. When I pass an ID of an existing term (integer) as $terms parameter, it creates a new term with given ID as a slug. This is most likely due to one of the plugins I use, but the problem goes away when I change lines 2241 and 2242 in taxonomy.php to the following:
$term_ids[] = intval($term_info['term_id']); $tt_id = intval($term_info['term_taxonomy_id']);
Would you consider adding this to the next version as a failsafe?
Change History (2)
Note: See
TracTickets for help on using
tickets.
Be sure that the value you're passing as the
$termsparameter is of typeinteger:It's likely that you're passing in a numeric string (eg
'3') rather than a true integer (eg3).