title: Wordpress : Pagination of ONLY ONE page redirects to Homepage
body: <p>The problem I'm facing is that on one Page my pagination urls always redirect to the homepage. The urls behind the pagination buttons look correct ( domein.com/currentpage/page/2 ) but it always redirects. The template is a copy of a page where it works perfectly, with only the post type changed to fit the content of this page. The pagination is rendered correctly, so the number of pages and items on it are correct. Both use the same custom pagination. The same pagination works on multiple pages in my site, except this one</p>
  
  <p>So this one works:
  <a href="https://www.startpuntonderwijs.nl/vacatures/" rel="nofollow noreferrer">https://www.startpuntonderwijs.nl/vacatures/</a></p>
  
  <p>And this one doesn't
  <a href="https://www.startpuntonderwijs.nl/leveranciers/" rel="nofollow noreferrer">https://www.startpuntonderwijs.nl/leveranciers/</a></p>
  
  <p>I've compared both scripts extensively and they seem 100% equal except for the lack of filters in "leveranciers" which I don't need there, and the different post type used in the query. </p>
  
  <p>Both links normal pages with their own template. Both have their own taxonomie's and posts with a matching post type. </p>
  
  <pre><code>&lt;?php 
  // Set counter to 0
  $counter = 0;
  
  // paged variable 
  $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
  
  // find ID's of all posts with the needed post type    
  $query_items = get_posts(array('post_type' =&gt; 'leveranciers', 
  'post_status'=&gt;'publish', 'posts_per_page'=&gt;-1));
  
  //create a new variable with the post ids
  foreach( $query_items as $item ) {
      $allposts[]=$item-&gt;ID; 
  }
  
  // the query 
  $wpb_all_query = new WP_Query(
      array(
          'post_type'      =&gt; 'leveranciers',
          'post__in'       =&gt; $allposts, 
          'paged'          =&gt; $paged,
          'orderby'        =&gt; 'date', 
          'order'          =&gt; 'DESC',
          'posts_per_page' =&gt; 10)
  );
  
  if ( $wpb_all_query-&gt;have_posts() ) : ?&gt;
      &lt;ul&gt;
  
  &lt;!-- the loop --&gt;
  &lt;?php while ( $wpb_all_query-&gt;have_posts() ) : $wpb_all_query-&gt;the_post(); ?&gt;
  
  &lt;!-- Presenting the info from the posts --&gt;
  
  &lt;?php endwhile; 
  
  if (function_exists('custom_pagination')) {
      custom_pagination($wpb_all_query-&gt;max_num_pages,"",$paged);
  } ?&gt;
  </code></pre>
  
  <p>Expected result would be that 
  <a href="https://www.startpuntonderwijs.nl/leveranciers/page/2/" rel="nofollow noreferrer">https://www.startpuntonderwijs.nl/leveranciers/page/2/</a> 
  would result the second page of paginated results for "leveranciers"</p>
  
  <p>But instead it always redirects to the homepage. and the "/page/2/" drops out of the url.</p>