Skip to main content
1 of 3
ronnyrr
  • 373
  • 2
  • 6
  • 16

Wordpress pagination not working because of subcategory

Currently I'm facing a really strange problem I can't seem to fix normally. I've using pagination on my category pages. I've got a 'News' category with some sub categories. One sub category is 'MVO nieuws'.

When I visit '/mvo-nieuws' the pagination is working (showing an older posts link).

if ($paged) : ?>
    <nav class="page-nav archive">

        <?php if ($prev = get_previous_posts_link()) : ?>
            <div class="alignleft">
                <span class="fo icons-angle-circled-left"></span>
                <span><?php previous_posts_link( 'Nieuwe berichten' ); ?></span>
            </div>
        <?php endif;

        if ($next = next_posts($listPosts->max_num_pages, false)) : ?>
            <div class="alignright">
                <span>
                    <a href="<?= $next; ?>">Oudere berichten</a>
                </span>
                <span class="fo icons-angle-circled-right"></span>
            </div>
        <?php endif; ?>

    </nav>
<?php endif; ?>

The pagination is forwarding to '/mvo-nieuws/page/2', but that page couldn't be found. I'll found out this is because its a subcategory of 'News', but I don't know why this seems to be a problem.

I've removed the category as a subcategory and now it's working. All my other primary categories are also working fine, but the subcategories are facing this problem.

My permalink settings are: '/%category%/%postname%/'. Hopefully anyone can help me out, thanks in forward!

ronnyrr
  • 373
  • 2
  • 6
  • 16