wp_get_object_terms() to get a list of all the terms attached to all the posts in the current query

I think you’re on the right track because wp_get_object_terms() can take an array of IDs for its first argument, it’s just that $wp_query is not the array you want. I can’t guarantee that this is more efficient (not my area of expertise), but I believe this [partially-tested] snippet would do what you want with at … Read more

Using multiple taxonomies to sort Custom Posts

Part of your trouble likely stems from the fact that you’re using the legacy version of the get_terms() function. As per the docs for this function: Since 4.5.0, taxonomies should be passed via the ‘taxonomy’ argument in the $args array: $terms = get_terms( array( ‘taxonomy’ => ‘post_tag’, ‘hide_empty’ => false, ) ); Therefore, we can … Read more