[wp-trac] [WordPress Trac] #41427: wp_set_object_terms creates new terms instead of linking existing ones
WordPress Trac
noreply at wordpress.org
Mon Jul 24 19:36:12 UTC 2017
#41427: wp_set_object_terms creates new terms instead of linking existing ones
-------------------------------------+------------------------------
Reporter: martin.krcho | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.8
Severity: normal | Resolution:
Keywords: close reporter-feedback | Focuses:
-------------------------------------+------------------------------
Changes (by boonebgorges):
* keywords: => close reporter-feedback
Comment:
Be sure that the value you're passing as the `$terms` parameter is of type
`integer`:
{{{
$term_id = (int) $term_id;
wp_set_object_terms( $post_id, $term_id, 'my_taxonomy' );
}}}
It's likely that you're passing in a numeric string (eg `'3'`) rather than
a true integer (eg `3`).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41427#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list