title: Wordpress pagination wp_query->max_num_pages return 0
body: <p>I have problem in pagination in wordpress custom page. I using template dazzling, this is pagination function: <a href="https://github.com/puikinsh/Dazzling/blob/master/inc/template-tags.php" rel="noreferrer">https://github.com/puikinsh/Dazzling/blob/master/inc/template-tags.php</a>
  But always $GLOBALS['wp_query']->max_num_pages is 0 (null). I try many time to change it, this is what I do now:</p>
  
  <pre><code> $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $query_args = array(
      'post_type' =&gt; 'post',
      'category__in' =&gt; '4',
      'posts_per_page' =&gt; 3,
      'max_num_pages' =&gt; 5,
      'paged' =&gt; $paged
    );
    // create a new instance of WP_Query
    $the_query = new WP_Query( $query_args );
  ?&gt;
  
  &lt;?php if ( $the_query-&gt;have_posts() ) : while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); // run the loop ?&gt;
    &lt;article&gt;
      &lt;h1&gt;&lt;?php echo the_title(); ?&gt;&lt;/h1&gt;
      &lt;div class="excerpt"&gt;
        &lt;?php the_excerpt(); ?&gt;
      &lt;/div&gt;
    &lt;/article&gt;
  &lt;?php endwhile; ?&gt;
  
  &lt;?php if ($the_query-&gt;max_num_pages &gt; 1) { // check if the max number of pages is greater than 1  ?&gt;
  &lt;?php dazzling_paging_nav()); ?&gt;
  
  &lt;?php } ?&gt;
  
  &lt;?php else: ?&gt;
    &lt;article&gt;
      &lt;h1&gt;Sorry...&lt;/h1&gt;
      &lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.'); ?&gt;&lt;/p&gt;
    &lt;/article&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>What I do wrong? Any idea?</p>