title: Get categories with posts that contain certain tag
body: <p>We have 10 categories, say A, B, C, D, etc</p>
  
  <p>We have 1 tag, say <code>tag</code></p>
  
  <p>The function <code>get_categories</code> will get all categories that have posts in them (by default), but what we need is that same function, only we need to get only categories with posts that have a certain tag.</p>
  
  <p>So category <code>A</code> has 5 posts with tag <code>tag</code>, Category <code>B</code> has none, Category <code>C</code> has 3. Then I want to see <code>A</code> and <code>C</code> in this list.</p>
  
  <p>Is it possible to filter <code>get_categories</code> by tag?</p>
  
  <h1>Update 1</h1>
  
  <p>Tried</p>
  
  <pre><code>$terms = get_terms( array(
              'taxonomy' =&gt; 'category',
              'hide_empty' =&gt; true,
              'meta_query' =&gt; array(
                  array(
                      'key'     =&gt; 'tag',
                      'value'   =&gt; 'my-tag-slug',
                      'compare' =&gt; '=',
                  ),
              ),
          ) );
  </code></pre>
  
  <p>Also tried with Tag ID. It's the standard post categories and tags that I'm using.</p>