title: WP Pagenavi / custom post type / custom page template 404 error
body: <p>Can someone help me out with this damn pagenavi problem? I have been trying all the possible solutions I found on stackoverflow and other forums, but I still get a 404 error when I want to visit the second page of the pagenavi.</p>
  
  <p>I stripped the code as clean as can be. This should work, right?</p>
  
  <pre><code>&lt;?php 
      $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
  
      $query = new WP_Query( array(
          'post_type' =&gt; 'professionals',
          'paged' =&gt; $paged
      ) );
  
      while ( $query-&gt;have_posts() ) : $query-&gt;the_post();
  
  
      echo '&lt;div&gt;'. the_title() .'&lt;/div&gt;';
  
  
      endwhile;
  
      wp_pagenavi( array( 'query' =&gt; $query ) );
  
      wp_reset_query();
  ?&gt;
  </code></pre>
  
  <p>Some more info: I am using a custom page template, different custom post types on the website and also a blog which includes pagenavi also (that does work). I also tried resetting the permalink every time I changed the code, also not helping.</p>
  
  <p>Thanks a lot for helping!</p>