title: $wp_query->max_num_pages not working for CPT
body: <p>am implementing custom pagination for my CPT products. Here what i tried
  -- in taxonomy-product-category.php</p>
  
  <pre><code>&lt;?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; 
      $args = array(
          'post_type' =&gt; 'products',
          'post_status' =&gt; 'publish',
          'posts_per_page' =&gt; 6,
          'parent' =&gt; 0,
          'paged' =&gt; $paged,
          'orderby' =&gt; 'date',
          'order' =&gt; 'DESC',
          'tax_query' =&gt; array(
              array(
                  'taxonomy' =&gt; $taxonomy,
                  'field' =&gt; 'slug',
                  'terms' =&gt; array($term-&gt;slug),
                  'operator' =&gt; 'IN'
              ),
          ),
      ); 
  ?&gt;
  </code></pre>
  
  <p>in functions.php</p>
  
  <pre><code> function get_pagination($range = 4) {
      global $paged, $wp_query;
      $no_of_posts = 6;
      // How much pages do we have?
      if (!$max_page) {
          $max_page = round($wp_query-&gt;max_num_pages / $no_of_posts);
      }
      die($wp_query-&gt;max_num_pages);
  }
  </code></pre>
  
  <p>But the issue is </p>
  
  <pre><code>if (!$max_page) {
      $max_page = round($wp_query-&gt;max_num_pages / $no_of_posts);
  }
  die($wp_query-&gt;max_num_pages);
  </code></pre>
  
  <p>For this it is always returning $wp_query->max_num_pages always returning 1.I don't want to divide it by number of posts . </p>