title: Get all terms in a custom Wordpress Query?
body: <p>I know how to get all of the Wordpress terms, but I need a "filtered" down version of the results. Is it possible to get all of the terms that are in the result of a Wordpress query? I have this query here:</p>
  
  <pre><code>&lt;?php
     $args=array(
    'post_type' =&gt; 'gw_activity',
    'post_status' =&gt; 'publish',
    'orderby' =&gt; 'date',
    'meta_query' =&gt; array(
       'relation' =&gt; 'AND',
        array(
           'key' =&gt; 'activity_category',
           'value' =&gt; 'mindful_life',
           'compare' =&gt; '='
        )
     ), 
    'posts_per_page' =&gt; 10
  );
  $my_query = null; 
  $my_query = new WP_Query($args);
  if( $my_query-&gt;have_posts() ) { 
   $all_terms = array();
    while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;      
    &lt;?php $terms = wp_get_post_terms( $my_query-&gt;post-&gt;ID, array( 'gw_activity_tag' ) ); ?&gt;
    &lt;?php       
          foreach ( $terms as $term ) {
              $all_terms[] = $term-&gt;name;
          }        
    ?&gt;                                            
    &lt;?php endwhile; }
    wp_reset_query();
  ?&gt;
  &lt;!-- End Custom Query --&gt;
  &lt;?php
      $unique_terms = array_unique( $all_terms ); 
      $result = array_unique($unique_terms);
      foreach ($result as $value) {
          echo $value . '&lt;br /&gt;';
      }
  </code></pre>
  
  <p>?></p>
  
  <p>But I can't figure how to run the query &amp; put a "Where" clause in it, like you can with MySQL. Any help / suggestion or even point me in the right direction would be greatly appreciated. I'm stuck</p>