I haven't tested this, but it feels about right. `the_category()` gives you all of the cats for the current post and `wp_get_object_terms()` loops through all of the supplied categories. $terms = wp_get_object_terms($id, the_category())