title: Filter get_terms to return only terms with published post and private post
body: <p><strong>I have found a filter for count also pubic and private post in get_terms filter</strong></p>
  
  <pre><code>     &lt;?php
          function get_terms_filter( $terms, $taxonomies, $args )
  {
      global $wpdb,$typenow;
      if($typenow == "product"){
          $taxonomy = $taxonomies[0];
          if ( ! is_array($terms) &amp;&amp; count($terms) &lt; 1 )
              return $terms;
          $filtered_terms = array();
          foreach ( $terms as $term )
          {
              $result = $wpdb-&gt;get_var("SELECT COUNT(*) FROM $wpdb-&gt;posts p JOIN $wpdb-&gt;term_relationships rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = $term-&gt;term_id AND p.post_status IN ('publish','private') LIMIT 1");
              $term-&gt;count = $result;
              if ( intval($result) &gt; 0 )
                  $filtered_terms[] = $term;
          }
          return $filtered_terms;
      }
      else{
          $taxonomy = $taxonomies[0];
          if ( ! is_array($terms) &amp;&amp; count($terms) &lt; 1 )
              return $terms;
          $filtered_terms = array();
          foreach ( $terms as $term )
          {
              $result = $wpdb-&gt;get_var("SELECT COUNT(*) FROM $wpdb-&gt;posts p JOIN $wpdb-&gt;term_relationships rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = $term-&gt;term_id AND p.post_status IN ('publish') LIMIT 1");
  
  
                  $filtered_terms[] = $term;
          }
          return $filtered_terms;
      }
  }
          add_filter('get_terms', 'get_terms_filter', 10, 3);
          ?&gt;
  </code></pre>