Fixes #3077 Cast $term->term_id to int in has_term