It doesn't return any terms if used with multiple post types like this `$flags = wpse57444_get_terms('flags', array('post_types' => array('country','city')));`. This is because $wpdb->prepare sanitizes the $post_types_str string to `p.post_type IN('country,city')` while it should be `p.post_type IN('country','city')`. See this ticket: [11102][1]. Just [don't use][2] $wpdb->prepare or use the solution in this topic to get around this: http://stackoverflow.com/a/10634225 [1]: http://core.trac.wordpress.org/ticket/11102 [2]: http://wordpress.org/support/topic/prepare-for-an-sql-processing-different-number-of-id