• Cannot seem to figure out this issue and it is very strange. When I add pagination to my cocktails CPT (which is the only one using this plugin), it behaves correctly with no 404s. If some of the posts are then set to drafts, it has a tendency to 404 the last pagination page. Any idea what’s going on?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter trumpetdev

    (@trumpetdev)

    
    <section class="aggregate" id="cocktails">
        <div class="aggregate__container--wrapper">       
    <?php $args = array(
                'post_type' => 'cocktails',
                'posts_per_page' => 8,
                'paged' => get_query_var('paged'),
                'post_status' => 'publish',
            );
            $the_query = new WP_Query($args);
            ?>
            <?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
            <?php get_template_part('global-templates/cocktail'); ?>
            <?php endwhile; 
            ?>
    
        </div>
        <div class="pagination">
           <?php $total_pages = $the_query->max_num_pages;
    
            if ($total_pages > 1) {
    
            $current_page = max(1, get_query_var('paged'));
    
            echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
            'prev_text' => __('<'),
            'next_text' => __('>'),
            ));
            } else ; ?><?php endif; ?>
    
            <?php wp_reset_postdata(); ?>
        </div>
    </section>
    Plugin Author Maya

    (@tdgu)

    Hi,
    There’s something else which mess with default query, try to disable other plugin one by one to see which produce the issue.
    It can be also the theme too, see if switching to another one makes a fix.

    Thanks

    Thread Starter trumpetdev

    (@trumpetdev)

    So far THIS has helped me! Guess it wasn’t the plugin after alL! Thank you.

    https://wordpress.stackexchange.com/questions/298767/pagination-page-2-displaying-404-on-archive-pages

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination – showing 404 on last page when multiple posts saved as drafts’ is closed to new replies.