title: Get archive category ID of custom post type
body: <p>I'm trying to get the ID of the category on a category archive page of a custom post type. So far, I'm using the code below, but it doesn't seem to be working. This code is in my <code>taxonomy-{taxonomy}.php</code> file.</p>
  
  <pre><code>$cat_name = single_cat_title('', false);
  $cat_id = get_cat_ID($cat_name);
  
  // $cat_name = 'Category Name', which works fine but,
  // $cat_id = 0, which is obviously not the id of the category
  </code></pre>
  
  <p>Do I need to do something special for retrieving the ID of a category of a custom post type?</p>
  
  <p>As a side note, I need this, so I can pass the ID into the <code>get_categories()</code> function</p>
  
  <pre><code>$args = array(
      'child_of' =&gt; $cat_id,
      'taxonomy' =&gt; 'taxonomy'
  );
  
  $categories = get_categories($args);
  </code></pre>