title: How to get only child terms of current post type?
body: <p>Having a custom post type 'pubs' with custom taxonomy 'types' in which admin enter parent terms and their child terms.
  Using this code to get all the terms of current post type:</p>
  
  <pre><code>$object_terms = wp_get_object_terms($post-&gt;ID, 'types', array('fields' =&gt; 'all'));
      if ($object_terms) {
          echo '' . '' . '' ;
          $res = '';
          foreach ($object_terms as $term) {
              $res .=  $term-&gt;name . ',';
          }
          echo rtrim($res,' ,').'' . '';
      }
  </code></pre>
  
  <p>this code displays both parent &amp; child terms.
  Is there any way to exclude parent terms from the result? I need the code to display only child terms related to the current post.</p>