title: WordPress: Get all tags from custom post type
body: <p>I'm trying to get all the tags that are within my custom post type &quot;resource&quot;.</p>
  <p>The problem is that I'm outside of the loop and struggling to find a way to get the functionality to work with the custom post type.</p>
  <p>I have the category setup also as &quot;resource_category&quot;</p>
  <p>My current code is:</p>
  <pre><code>$tax = 'post_tag';
  $terms = get_terms( $tax );
  $count = count( $terms );
  
  if ( $count &gt; 0 ): ?&gt;
      &lt;div class=&quot;post-tags&quot;&gt;
      &lt;?php
      foreach ( $terms as $term ) {
          $term_link = get_term_link( $term, $tax );
          echo '&lt;a href=&quot;' . $term_link . '&quot; class=&quot;tax-filter&quot; title=&quot;' . $term-&gt;slug . '&quot;&gt;' . $term-&gt;name . '&lt;/a&gt; ';
      } ?&gt;
      &lt;/div&gt;
  &lt;?php endif;
  </code></pre>
  <p>Can anyone help?</p>