Wordpress custom post pagination 404 error

custom taxonomy pagination 404
wordpress custom post type 404
wordpress pagination 404
wordpress custom permalinks 404
wordpress custom post type redirect slug
custom post type single page not found
custom post type category page not found
custom post type category page not working

I've been looking around all day for an answer but no luck.

I have made a custom post type so I can display posts on the page template but pagination is not working .I get a 404 error.

Maybe some of you can guide me and tell me what is the problem.Here is the site.

Use this password broncosrule. Thank You.

Here is the code .

Custom page template:

 * Template Name: Custom Page
 * The custom page template file

<?php get_header(); ?>


  $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;

  $custom_args = array(
      'post_type' => 'trestleboard',
      'posts_per_page' => 1,
      'paged' => $paged


  $custom_query = new WP_Query( $custom_args ); ?>

  <?php if ( $custom_query->have_posts() ) : ?>

    <!-- the loop -->
    <?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
      <article class="loop">
        <!--<h3><?php the_title(); ?></h3>-->
        <div class="content">
          <?php the_content(); ?>
    <?php endwhile; ?>
    <!-- end of the loop -->

    <!-- pagination here -->
      if (function_exists(custom_pagination)) {

  <?php wp_reset_postdata(); ?>

  <?php else:  ?>
    <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
  <?php endif; ?>

<?php get_footer(); ?>

Functions.php file

// Our custom post type function
function custom_pagination($numpages = '', $pagerange = '', $paged='') {

  if (empty($pagerange)) {
    $pagerange = 2;

   * This first part of our function is a fallback
   * for custom pagination inside a regular loop that
   * uses the global $paged and global $wp_query variables.
   * It's good because we can now override default pagination
   * in our theme, and use this function in default queries
   * and custom queries.
  global $paged;
  if (empty($paged)) {
    $paged = 1;
  if ($numpages == '') {
    global $wp_query;
    $numpages = $wp_query->max_num_pages;
    if(!$numpages) {
        $numpages = 1;

   * We construct the pagination arguments to enter into our paginate_links
   * function. 
  $pagination_args = array(
    'base'            => get_pagenum_link(1) . '%_%',
    'format'          => 'page/%#%',
    'total'           => $numpages,
    'current'         => $paged,
    'show_all'        => False,
    'end_size'        => 1,
    'mid_size'        => $pagerange,
    'prev_next'       => True,
    'prev_text'       => __('&laquo;'),
    'next_text'       => __('&raquo;'),
    'type'            => 'plain',
    'add_args'        => false,
    'add_fragment'    => ''

  $paginate_links = paginate_links($pagination_args);

  if ($paginate_links) {
    echo "<nav class='custom-pagination'>";
      echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
      echo $paginate_links;
    echo "</nav>";


[Resolved] Custom Post Type Pagination 404 error forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP. I have the following code and when I go to the second page I’m getting a 404 error… I know I still have one more item. Any idea? <?…

Can you try this link . They explained it in detail.

Also please check your rewrite rules.


On the 404 page I also get this error: Trying to get property of non-object in (…)/​wordpress/wp-includes/post-template.php on the line 29. Another cause of 404 errors is whenever a new post type is registered you have to “flush” your rewrite rules in WordPress. This can be done by going to Settings > Permalinks and clicking the save button (mentioned in the first section of this post).

This is work for me please change it with your custom post type name "your_custom_post_type"

 function custom_posts_per_page( $query ) {
        //fixing pagination of custom post type
        if ( $query->is_archive('your_custom_post_type') ) {
            set_query_var('posts_per_page', 1);
    add_action( 'pre_get_posts', 'custom_posts_per_page' );

That is reversed from normal CPT permalinks. They should be by default example.com/my-cpt/post-name/page/2/. Does this format work on the site? Page numbers and buttons display on a custom post type archive and the archives for custom taxonomies but render 404. What am I doing wrong? Here's the query for the custom post type archive: &l

WP-PageNavi with Custom Post Types Shows 404 Error​​ Scenario: You're using WP-PageNavi for pagination and for when you click on the page items it returns a 404 error page rather than the actual post. You also have your permalink structure set to other than default ( /%category%/%postname%/ etc.) I am trying to paginate in WordPress custom post type. Pagination seems ok in the front end but getting 404 error when clicking on Page: 2, 3, 4 My code

Custom Post Type causing 404 errors accessing page 2 + WordPress Pagination​. Finding the answer to common WordPress issues can be a headache  In most cases this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your.htaccess file manually. Login to your server using FTP, and modify the.htaccess file which is located in the same location where folders like /wp-content/ and /wp-includes/ are located.

But anyone whom has worked with custom post types has probably encountered the dreadful 404 Not Found Error when trying to access a post  The basic issue is that every paginated page for my blog is going to a 404 page. /page/2/, /page/3/, etc. It used to be working fine, but is not now. I think maybe the change to 3.9 did it.

  • Can you access your page with direct link? like clintbronson.com/page-template
  • @Muhammad No , i chose the template inside the page , which is this clintbronson.com/trestleboard , as you can see it shows 1 post , its just pagination that is not working.
  • @AgnesPandek Would you please save you permalink settings > permalinks again and after check it?
  • yes, i changed the page slug and its working , supid me ... and i wasted so many hours today . Thanks a lot !!!!
  • I've wasted a few hours on that one myself!