title: Disabling pagination functionality on custom post type
body: <p>I have created a custom post type with the following arguments:</p>
  <pre><code>'hierarchical'        =&gt; false,
  'public'              =&gt; false,
  'show_ui'             =&gt; true,
  'show_in_menu'        =&gt; true,
  'show_in_nav_menus'   =&gt; false,
  'show_in_admin_bar'   =&gt; true,
  'menu_position'       =&gt; 5,
  'can_export'          =&gt; false,
  'has_archive'         =&gt; false,
  'exclude_from_search' =&gt; true,
  'publicly_queryable'  =&gt; false,
  'capability_type'     =&gt; 'post',
  'show_in_rest' =&gt; true
  </code></pre>
  <p>I have disabled <code>'has_archive'</code> as I want to create a custom page template that can be used for any page in order to show a custom archive page for any post type. I have created this custom archive page and pagination following this tutorial: <a href="https://njengah.com/custom-query-pagination-in-wordpress/" rel="nofollow noreferrer">https://njengah.com/custom-query-pagination-in-wordpress/</a></p>
  <p>The page that I'm using this page template with is called &quot;news&quot;, same name as the custom post type itself. By having <code>'has_archive'</code> set to <code>false</code>, I can use that page as any page since the archive page is deactivated and shouldn't replace the page with a default archive template.</p>
  <p>The problem I stumble upon is that when navigating to the next page in the pagination, i. e. to the URL: /news/page/2. This makes the page use the <code>home.php</code> template instead of the custom page template. I've tried to assign the page template with the custom archive and pagination to another page, named differently than &quot;news&quot;. And it works on that one.</p>
  <p>So the problem seems to be that as the page is named the same as the post type (&quot;news&quot;), it still fall backs to using the <code>home.php</code> template for the rest of the pagination pages, even though <code>'has_archive'</code> is set to <code>false</code>.</p>
  <p>Is there any way to work around this?</p>