Terms not assigned to a user are displayed as ticked
-
Hello,
I’ve added a taxonomy to Users with several terms on that taxonomy. I’ve assigned different multiple terms to different users.
However, I’ve noticed that some users in the Admin screen would have terms displayed as ticked (assigned to them) even though they haven’t been assigned to them!! I’ve checked the DB and the correct data is stored there, but on the admin additional terms are displayed as ticked!
I’ve looked at the code and changed the following line:
<input type="radio" name="<?php echo $key?>" id="<?php echo "{$key}-{$term->slug}"?>" value="<?php echo $term->slug?>" <?php checked(true, is_object_in_term($user->ID, $key, $term))?> />
to
<input type=”radio” name=”<?php echo $key?>” id=”<?php echo “{$key}-{$term->slug}”?>” value=”<?php echo $term->slug?>” <?php checked(true, is_object_in_term($user->ID, $key, $term->term_id))?> />
I think that
is_object_in_term()
is behaving unexpectedly when passed a term object, rather than its ID. That seems to fix it.I hope that helps someone!
Thanks for the plugin! Perhaps you will consider updating it with that bit of code, no worries if not, it might be just misbehaving a bit in my case ??
Dasha
- The topic ‘Terms not assigned to a user are displayed as ticked’ is closed to new replies.