stuttter / wp-user-groups

Group users together with taxonomies & terms
https://wordpress.org/plugins/wp-user-groups/
GNU General Public License v2.0
48 stars 22 forks source link

Array of ints are re-cast to strings in `wp_set_terms_for_user` #19

Closed chrisvanpatten closed 6 years ago

chrisvanpatten commented 6 years ago

wp_set_terms_for_user runs the array of $terms through sanitize_key:

https://github.com/stuttter/wp-user-groups/blob/master/wp-user-groups/includes/functions/common.php#L74

This causes an array of (int) term_ids to be cast to strings, which in turn causes wp_set_object_terms to add new terms with the IDs as the term names.

JJJ commented 6 years ago

Confirmed.

I wonder if we are better off removing that line, and letting wp_set_object_terms() sort it out entirely?